Yii2从私人git服务器安装扩展 - 框架没有看到它 [英] Yii2 installing extension from private git server - framework not see it
问题描述
我创建了我的yii2扩展。我把它放在我的私人git服务器上。使用以下代码管理扩展程序,并通过作曲者下载:
repositories:[
{
type:package,
package:{
name:author / yii2-user,
version:dev-master,
source:{
url:ssh://git@my.server.pl/srv/git/user.git,
type:git,
reference:origin / master
}
}
}
],
和author / yii2-user:*,在
require
部分。
这一切正常,但有一个问题。下载扩展名后,作曲家应将其添加到 yiisoft \extension.php
文件中,但不会添加。
在我的扩展中,我有这样的composer.json文件:
{
name:author / yii2 -user,
description:我们的应用的身份验证和用户管理器,
keywords:[yii,admin,auth],
type :yii2-extension,
support:{
issues:,
source:
},
作者:[
{
name:j2,
email:j2@j2.j2
}
],
require:{
yiisoft / yii2:*,
yiisoft / yii2-bootstrap:*
},
autoload:{
psr-4:{
author \\\\\\\\:
}
}
}
我试图找到一个解决方案,但它很难。不要使用type:package
存储库如果你有自己的控制下的源代码。如果您使用type:vcs
存储库并提供源代码服务器的URL,则您必须添加的每个信息都可以由Composer自己找出。 / p>
正确的方法是:
repositories:[
{
type:vcs,
url:ssh://git@my.server.pl/srv/git/user.git
}
],
Composer会扫描此存储库中的作曲家。 json
解析它,然后知道所有的元数据,如名称,类型(如果你想将它安装为yii扩展名,这可能很重要),版本或分支等。
包类型的存在只允许任何需要一个不再维护的特定软件的人,因此不会添加缺少的 composer.json
,并且/或者在packagist.org注册将永远不会发生,以替代这种缺乏信息。不要将它用于自己的软件。
I've created my yii2 extension. I keep it on my private git server. I managed the extension to be downloaded through composer using following code:
"repositories": [
{
"type": "package",
"package": {
"name": "author/yii2-user",
"version": "dev-master",
"source": {
"url": "ssh://git@my.server.pl/srv/git/user.git",
"type": "git",
"reference": "origin/master"
}
}
}
],
and "author/yii2-user": "*",
in require
section.
It all works fine but there is one problem. After downloading extension, composer should add it to the yiisoft\extension.php
file but it's not being added.
In my extension I have composer.json file like this:
{
"name": "author/yii2-user",
"description": "Auth and user manager for our apps",
"keywords": ["yii", "admin", "auth"],
"type": "yii2-extension",
"support": {
"issues": "",
"source": ""
},
"authors": [
{
"name": "j2",
"email": "j2@j2.j2"
}
],
"require": {
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*"
},
"autoload": {
"psr-4": {
"author\\user\\": ""
}
}
}
I'm trying to find a solution but it's a hard one.
Don't use the "type": "package"
repository if you have the source code under your own control. Every info you have to add there can be figured out by Composer itself if you use the "type": "vcs"
repository and give the URL of the source code server.
The correct way would be:
"repositories": [
{
"type": "vcs",
"url": "ssh://git@my.server.pl/srv/git/user.git"
}
],
The Composer scans this repository for a composer.json
, parses it and then knows all the metadata like name, type (probably important if you want to install it as a yii extension), version or branch etc.
The package type does only exist to allow anybody who needs one particular software which is not maintained anymore and therefore a missing composer.json
will never be added and/or registration at packagist.org will never be happening to substitute this lack of information. Don't use it for your own software, ever.
这篇关于Yii2从私人git服务器安装扩展 - 框架没有看到它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!