Laravel uses:
composer create-project laravel/laravel your-project-name --prefer-dist
How can I make my own package so that I can use
composer create-project mycompany/projectx your-project-name --prefer-dist
Can I use bitbucket a private repository for this ?
Project template for creating and initializing a new PHP project from with a composer project or a composer package is named PHP Project from Composer . Open the New Project window in File / New / Project menu, choose PHP Project from Composer , and specify the new project location.
Package# Composer is a dependency manager. It installs packages locally. A package is essentially a directory containing something. In this case it is PHP code, but in theory it could be anything.
As long as the package is available on packagist.org, you can use the composer create-project
command.
If you don't want to put your package on packagist, please refer to composer create-project from private repo:
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.
You can also just use git clone
and then execute composer install
yourself.
They is nothing special to do for you package to be installable with composer create-project
.
Just declare you dependencies in the composer.json of your package if you have any. The command will just copy the package into the current directory, than run composer install
You can use a private repository if you use authentification over ssh, for example:
{
"require": {
"vendor/my-private-repo": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "[email protected]:vendor/my-private-repo.git"
}
]
}
See https://getcomposer.org/doc/05-repositories.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With