composer 创建一个github 项目,然后可以通过composer下载


1.在github申请账户,申请完成就可以创建项目了

2.创建一个composer.json文件:内容如下:

{
  "name": "zqy234/terrytest",
  "description": "Yii2 zqy234 terrytest",
  "keywords": [
    "yii2",
    "terrytest"
  ],
  "homepage": "https://github.com/zqy234/terrytest",
  "type": "yii2-extension",
  "license": "MIT",
  "support": {
    "source": "https://github.com/zqy234/terrytest"
  },
  "authors": [
    {
      "name": "terry water",
      "email": "zqy234@126.com"
    }
  ],
  "minimum-stability": "stable",
  "require": {
    "php": ">=5.4.0",
    "yiisoft/yii2": ">=2.0.6"
   
  },
  "autoload": {
    "psr-4": {
      "terry\\": ""
    }
  },
  "config": {
    "process-timeout": 1800
  }
}

3. 打开:https://packagist.org/packages/submit

把github的地址提交,提交成功后的界面:


4.到这里就提交成功了,您可以使用composer下载了:

composer require  zqy234/terrytest:dev-master
[root@iZ942k2d5ezZ cc]# composer require  zqy234/terrytest:dev-master
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing zqy234/terrytest (dev-master c80914f)
    Cloning c80914fc7dedc2f464f16fb0af5d3a843326bddb

Writing lock file
Generating autoload files


5.使用正式版本号(稳定版本号)

首先去github中:








然后再packagist中更新:





然后就可以更新了:

[root@iZ942k2d5ezZ cc]# composer require --prefer-dist zqy234/terrytest
Using version ^1.0 for zqy234/terrytest
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing yiisoft/yii2-composer (2.0.3)               
    Loading from cache

  - Installing bower-asset/jquery (2.1.4)
    Loading from cache

  - Installing bower-asset/yii2-pjax (v2.0.5)
    Loading from cache

  - Installing bower-asset/punycode (v1.3.2)
    Loading from cache

  - Installing bower-asset/jquery.inputmask (3.1.63)
    Loading from cache

  - Installing cebe/markdown (1.1.0)
    Loading from cache

  - Installing ezyang/htmlpurifier (v4.6.0)
    Loading from cache

  - Installing yiisoft/yii2 (2.0.6)
    Loading from cache

  - Installing zqy234/terrytest (1.0.0)
    Downloading: 100%         

Writing lock file
Generating autoload files
[root@iZ942k2d5ezZ cc]# 


这样就安装成功了。


6.版本号自动更新(github和packagist之间)

访问:https://packagist.org/profile/

获取api token

详细说明地址:https://packagist.org/about







填写的url的格式:https://packagist.org/api/bitbucket?username=USERNAME&apiToken=API_TOKEN

可以用:

curl -XPOST -H'content-type:application/json' 'https://packagist.org/api/update-package?username=USERNAME&apiToken=API_TOKEN' -d'{"repository":{"url":"PACKAGIST_PACKAGE_URL"}}'
来检测。

测试:

在github那边增加一个稳定版本号

然后再 https://packagist.org/packages/zqy234/terrytest#1.0.1

发现:1.0.1出来了。




基本的详细大致使用就这些

总之,可以快乐的,让别人下载自己的库包了

composer require --prefer-dist zqy234/terrytest








  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值