发布于 2016-01-15 02:58:35 | 168 次阅读 | 评论: 0 | 来源: PHPERZ

这里有新鲜出炉的精品教程,程序狗速度看过来!

Packagist PHP存储库管理器

Composer(以及它的默认存储库管理器Packagist)是一个新的项目,尝试以单个项目为基础,提供包和依赖管理,它比起安装全系统packages的PEAR来说,与Maven更相似。


1.mkdir app && cd app
2.composer init
3.vi composer.json

{
    "name": "yourname/yourpro",
    "description": "desc",
    "authors": [{
        "name": "yourname",
        "email": "yourname@gmail.com"
    }],
    "require": {},
    "autoload": {
        "classmap": [
            "lib/"
        ]
    }
}

4.创建git库yourname/yourpro
5.git remote add origin git@github.com:yourname/yourpro 设置公钥略过
5.git add .&& git commit -am "init" && git pull orgin master && git push orgin master
6.创建tag composer包版本来自于git分支和tag,分支代表dev版本(除master外),tag代表stable版本
7.git tag 1.0 && git push origin --tags
8.登录https://packagist.org/ 点击由上角的submit提交git仓库的地址
9.添加 GitHub Service Hook domain 指向packagist的地址


10.安装库 composer require 'yourname/yourpro:1.0.0
如果报错,执行composer update nothing:

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your min
imum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> f
or more details.


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务