[PHP] 发布一个类库到composer

首先有github仓库 , 仓库的结构可以是这样

 

 

composer.json文件可以类似这样

{
    "name": "taoshihan/php-router",
    "license": "Apache-2.0",
    "description": "php simple router",
    "type": "library",
    "authors": [
        {
            "name": "taoshihan1991",
            "email": "630892807@qq.com"
        }
    ],
    "autoload": {
        "psr-4": {
            "taoshihan\\": "src"
        }
    }
}

github地址:

https://github.com/taoshihan1991/php-router

 

需要打了tag

git tag v1.0

git push origin v1.0

 

在这个网站注册 , 或者github直接登录 , 点击submit , 输入自己的仓库就ok了

https://packagist.org/

 

 

别人使用的时候就可以 composer require 仓库

composer require taoshihan/php-router

posted @ 2021-05-14 18:15  唯一客服系统开发笔记  阅读(121)  评论(0编辑  收藏  举报