Private git repositories with PHP's composer

03 Jun 2013

Composer is a dependency management tool for PHP, it just like Rubygems. However, to deal with private git repositories, it doesn’t work for me if I follow the instructions at this page, what I found that there is another way to work with private git repositories is something like:

    "name": "my/app",
    "repositories": [
            "type": "package",
            "package": {
                "name": "vendor/analyze",
                "version": "1.0.0",
                "source": {
                    "type": "git",
                    "url": "git@host:/path/to/vendor/analyze.git",
                    "reference": "master"
    "require": {
        "vendor/analyze": "1.0.0"
    "autoload": {
        "psr-0": {"Analyze": "src/"}

The structure of the analyze package looks like:

├── composer.json
├── src
│   └── Analyze 
│       └── Generator.php
└── vendor

Actually, with the package type, you can use any kind of packages.

Fork me on GitHub