来自私人仓库的作曲家创建项目 [英] composer create-project from private repo

查看:21
本文介绍了来自私人仓库的作曲家创建项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个托管在 Bit Bucket 上的私人项目.我有一个 SSH 密钥设置.有没有办法像在 Packagist 上一样使用 php composer create-project vendor/name path 命令?

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?

推荐答案

嗯,有不同的方法可以实现这一点,即使用 composer 存储库而不是 packagist.org,这是一种更好更集中的方式管理您的私人作曲家包.另一种方法是使用 composer.json,在每个环境中将您的私有存储库合并到您的环境中.

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.

Composer 允许您使用私有存储库来创建项目.

就这样……

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

因为您不会向 packagegist 提交私有包.该网址至少需要一个 packages.json 文件,您可以使用 satis 或您自己的 packagist 如果您想要更动态的 packages.json 解决方案.

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.

使用 composer.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.

为您的环境全局配置您的私有存储库到您的 config.json.然后像往常一样..

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

composer create-project vendor/name path

这篇关于来自私人仓库的作曲家创建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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