自定义插件到Composer源并设置包自动更新

  • 1、在GitHub创建空项目,例如:debugger
  • 2、在本地Clone项目到空目录下,例如:git clone https://github.com/yuncopy/debugger.git
  • 3、复制src代码源文件目录到此空目录下,并创建对应composer.json文件
    • autoload-命名空间指向目录src
{
    "name": "php-debug/debugger",
    "type": "php-extension",
    "description": "The debugger  for the wzphp framework",
    "keywords": ["debugger", "redis", "wzphp", "framework"],
    "license": "MIT",
    "support": {
        "issues": "https://github.com/yuncopy/debugger/issues",
        "forum": "https://github.com/yuncopy",
        "source": "https://github.com/yuncopy/debugger"
    },
    "authors": [
        {
            "name": "Ajay",
            "email": "[email protected]"
        }
    ],
    "require": {

    },
    "autoload": {
        "psr-4": {
          "Debugger\\": "src/"
        }
    }
}
  • 提交并PUSH到GitHub托管
  • 登陆https://packagist.org/镜像管理网站
  • 点击菜单submit按钮,填写GitHub源代码地址
  • 检测check源地址再submit提交
  • 配置composer包版本与GitHub版本,自动更新版
    • This package is not auto-updated. Please set up the GitHub Hook for Packagist so that it gets updated whenever you push!

    • 按照提示获取API_TOKEN和PACKAGIST_PACKAGE_URL (使用文档)

      • 例如执行curl -XPOST -H'content-type:application/json' 'https://packagist.org/api/update-package?username=yuncopy&apiToken=API_TOKEN' -d'{"repository":{"url":"https://github.com/yuncopy/debugger.git"}}'
    • 版本新增、删除

      • 新增
        • git tag -a v0.1.0 -m 'tag init'
        • git push origin --tags
      • 删除
        • git tag -d v0.1.1
        • git push origin :refs/tags/v0.1.1
  • composer下载验证包,尽量使用官方地址
    • php composer require php-debug/debugger -vvv

你可能感兴趣的:(自定义插件到Composer源并设置包自动更新)