Yii2 installing an extension from a private git server - can't see the framework

I created the yii2 extension. I save it on my personal git server. I managed to download the extension through the composer using the 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 the require section. Everything works fine, but there is one problem. After downloading the extension, the composer should add it to the yiisoft\extension.php file, but it is not added.

In my extension, I have a composer.json file as follows:

 { "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 am trying to find a solution, but it is difficult.

+4
source share
1 answer

Do not use the "type": "package" repository if you have the source code under your own control. Each information you need to add there can be found out by Composer itself if you use the "type": "vcs" and specify the URL of the source code server.

The right way:

 "repositories": [ { "type": "vcs", "url": "ssh:// git@my.server.pl /srv/git/user.git" } ], 

Composer scans this repository on composer.json , parses it, and then knows all the metadata, such as name, type (perhaps important if you want to set it as a yii extension), version or branch, etc.

The type of package exists only to allow someone who needs some specific software that is no longer supported, and therefore the missing composer.json will never be added and / or registration at packagist.org will never happen, replace this lack of information. Do not use it for your own software.

+9
source

Source: https://habr.com/ru/post/973219/


All Articles