如何将github上的微信客户端类库能够通过composer工具下载

我将自己开发的微信客户端类库放到了github上面去了。

然后我在我的项目里面添加了一个composer.json文件

内容如下

{
  "require": {
    "weixin/weixin": "dev-master"
  }
}

然后利用composer install命令下载这个类库,但是发生了以下的错误

Loading composer repositories with package information

Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package weixin/weixin dev could not be found.

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

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

这个问题的发生的原因是 尽管我将代码都上传到github上面去了。但是没有将这个weixin/weixin 这样的package名字在 Packagist网站 注册过。

这样composer工具就找不到这个package name了,所以出错了。

解决方法如下,

1 浏览器打开 这个网站,然后要点击login,出现如下画面

2 用 最下面的 Login with github来登陆。登陆完成之后的画面如下

3 点击上面的submit package 按钮,

 4 在check按钮之后 输入 你的github的项目地址,例如我的是 https://github.com/handsomegyr/weixin,然后点击check

在这个页面上可以看到

这个是说明 现在的这个package 还无法自动更新。

5 根据提示点击 GitHub Server Hook的链接 进入到如下的画面

在这个画面上可以看到 用户名:handsomegyr  Your API Token:xxxxxxx,将他们记录下来,根据下面的提示

6 在github网站上去处理这个问题,画面如下。

输入User和Token,打勾 Active ,点击Update Settings,如果没有发生错误,这样就解决package 自动更新的问题了。 

原文地址:https://www.cnblogs.com/guoyongrong/p/3534225.html