Last Updated: February 25, 2016
·
6.951K
· aimfeld

Composer install without composer.json

Composer makes PHP dependency management very easy, if packages are provided on packagist or on your own server using satis.

However, a lot of libraries on GitHub don't provide a composer.json file or are not available on packagist. Here's the good news: you can install about everything on GitHub using composer, if you provide the specification in your own composer.json file. Here's an example how to install SlickGrid 2.0.2 (a javascript datagrid component):

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "mleibman/SlickGrid",
                "version": "2.0.2",
                "dist": {
                    "url": "https://github.com/mleibman/SlickGrid/archive/2.0.2.zip",
                    "type": "zip"
                },
                "source": {
                    "url": "git@github.com:mleibman/SlickGrid.git",
                    "type": "git",
                    "reference": "tags/2.0.2"
                }
            }
        }
    ],
    "require": {        
        "mleibman/SlickGrid": "2.0.2"
    }
}