How to create your own composer package

Laravel uses:

composer create-project laravel/laravel your-project-name --prefer-dist 

How can I create my own package to use

 composer create-project mycompany/projectx your-project-name --prefer-dist 

Is it possible to use a bitpacket for private storage for this?

+6
source share
2 answers

While the package is available on packagist.org , you can use the composer create-project command.

If you do not want to place your package in a package, contact the composer project from a private repo :

Same...

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

Since you are not sending a private package to packagist. This file url requires at least the package.json file, you can use satis or your own packagist if you want a more dynamic solution for package.json.

You can also just use git clone and then run composer install yourself.

+3
source

There is nothing special about installing a package using composer create-project .

Just tell you the dependencies in the linker of your package, if you have one. The command will simply copy the package to the current directory and then run the installation link

You can use a private repository if you use authentication via ssh, for example:

 { "require": { "vendor/my-private-repo": "dev-master" }, "repositories": [ { "type": "vcs", "url": " git@bitbucket.org :vendor/my-private-repo.git" } ] } 

See https://getcomposer.org/doc/05-repositories.md

+1
source

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


All Articles