composer create-project from private repo

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.

First

Composer allows you to use private repositories to create projects.

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.

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.

Second

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

composer create-project vendor/name path

The way I used to:

composer create-project vendor/name path --repository="{\"url\": \"https://bitbucket.org/user/project.git\", \"type\": \"vcs\"}" --stability=dev --remove-vcs

Reference: https://getcomposer.org/doc/03-cli.md#create-project


Yes, Composer allows you to add private projects as 'repositories' to your composer.json file. So therefore you can include private projects into another project.

It provides support for GitHub and Bitbucket (as well as SVN and Mercurial).

You need to modify your composer.json file to look something like this:

{
    "repositories": [ {
        "type": "package",
        "package": {
            "name": "TheShiftExchange/test",
            "version": "1.0.0",
            "source": {
                "url": "https://github.com/TheShiftExchange/test.git",
                "type": "git",
                "reference": "master"
              }
         }
    }],
    "require": {
        "laravel/framework": "4.0.*",
        "TheShiftExchange/test": "1.0.*"
    },
}