composer create-project从私人仓库 [英] composer create-project from private repo

查看:601
本文介绍了composer create-project从私人仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个私人项目托管在比特桶。我有一个SSH密钥设置。是否有一种方法,我可以使用 php composer create-project vendor / name path 命令,如同在Packagist上一样?

解决方案

有很多不同的方法来完成这一点,使用composer存储库,而不是packagist.org,这是一个更好的更集中的方式管理您的私人作曲家包。另一种方法是使用composer.json,它在您的环境中,每个环境中包含您的私有仓库。



第一



Composer允许您使用私人存储库创建项目。



像这样...

  composer create-project vendor / name path --repository- url = http://repo.yourcomposerrepo.com 

由于您不会提交私人包包装。该网址至少需要 packages.json 文件,您可以使用 satisfied 或您自己的 packagist ,如果你想要一个更动态的解决方案package.json。



使用composer.json的方法适用于已经创建的项目,这些项目将使用自定义存储库作为私有包,而不是从私有存储库创建新项目。



第二



将您的私人存储库配置为您的 config.json 全局为您的环境。

  composer create-project供应商/名称路径
pre>

I have a private project hosted on Bit Bucket. I have an SSH key setup. Is there a way I can use the php composer create-project vendor/name path command in the same way as If it was on Packagist?

解决方案

Well there are different ways to accomplish this one being the use of a composer repository that is used instead of packagist.org, which is a better more centralized way to manage your private composer packages. The other method is to use a composer.json that incorporates your private repos within your environments, per environment.

First

Composer allows you to use private repositories to create projects.

Like so...

composer create-project vendor/name path --repository-url=http://repo.yourcomposerrepo.com

Since you won't submit a private package to packagist. That url just needs a packages.json file at minimum, you could use satis or your own packagist if you want a more dynamic solution to the packages.json.

The method for using composer.json applies to already created projects that will use custom repositories for private packages, not for creating new projects from private repositories. Use the next method if you want to go down a similar route.

Second

Configure your private repository into your config.json globally for your environment. Then like normally..

composer create-project vendor/name path

这篇关于composer create-project从私人仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆