laravel-composer 发布扩展包

/home$ cd blog

/home/blog$ mkdir -p packages/unrelaxs/eslog/src

/home/blog目录下修改composer.json

"psr-4": {
    "App\\": "app/",
     "Unrelaxs\\Eslog\\": "packages/unrelaxs/eslog/src"
},

/

/home/blog$ composer dumpautoload

/home/blog$ cd packages/unrelaxs/eslog/src

/home/blog/packages/unrelaxs/eslog/src$ composer init

修改 /home/blog/packages/unrelaxs/eslog/src下的composer.json

{
    "name": "unrelaxs/eslog-for-laravel",
    "description": "about laravel log to elasticsearch",
    "require": {
        "babenkoivan/scout-elasticsearch-driver": "^4.0"
    },
    "autoload": {
        "psr-4": {
            "Unrelaxs\\Eslog\\": "src/"
        }
    }
}

接着在 /home/blog/packages/unrelaxs/eslog/src 创建provider

laravel-composer 发布扩展包_第1张图片

回到项目根目录

这行下面命令,就可以进行调试package的代码了

/home/blog$ php artisan vendor:publish

接下来发布扩展包

2.在github创建个项目,将/home/blog/packages/unrelaxs/eslog目录的代码推送到github上, 如 我写的插件。

3.除了push上去,要打标签

/home/blog/packages/unrelaxs/eslog$  git tag -a v0.1.0 -m "tag init"

/home/blog/packages/unrelaxs/eslog$  git push origin --tags

4. 打开https://packagist.org/ 注册个账号

5. 登录后打开这个链接https://packagist.org/profile/edit,以下是图片操作laravel-composer 发布扩展包_第2张图片

6. https://packagist.org/packages/submit 打开这个链接,把github的扩展包的地址提交 如: https://github.com/unrelaxs/eslog-for-laravel

7. 最后 在laravel项目执行

/home/blog$ composer require unrelaxs/eslog

 

你可能感兴趣的:(laravel,php)