Skip to content
Everett Griffiths edited this page May 21, 2014 · 3 revisions

Composer is a PHP package manager that finally brings something sensible to world of PHP development. If you find a package on the Packagist website, Composer makes it easier to use those libraries in your project. Composer represents the future of PHP development, and Repoman attempts to make MODx package development compatible with it.

Before you you breathe a sigh of relief, we have to break it to you: Composer has sparse documentation, so for some of us, learning it can be a long and uncomfortable journey. Keep your chin up: you will get it working sooner or later, and you do have the sympathy of many developers who have gone before you.

composer.json

Repoman reads your composer.json file. You can read up about the supported composer.json schema, or take a look at the sample Repoman-compatible composer.json below:

{
    "name": "vendorname/packagename",
    "description": "My Description",
    "type": "library",
    "keywords": ["one","two"],
    "homepage": "github.com/vendorname/packagename",
    "license": "GPL2",
    "authors": [
        {
            "name": "Some Body",
            "email": "[email protected]",
            "homepage": "http://somebody.com"
        }
    ],
    "support": {
        "email": "[email protected]",
        "issues": "github.com/vendorname/packagename/issues",
        "forum": "forums.modx.com/",
        "wiki": "github.com/vendorname/packagename/wiki",
        "source": "github.com/vendorname/packagename"
    },    
    "require": {
        "php": ">=5.3"
    },
    "autoload": {
        "classmap":["src"]
    },
    "extra": {
        "package_name": "Bloodline",
        "namespace": "bloodline",
        "version": "1.0.2",
        "release": "pl",
        "category":"Bloodline",
        "core_path": "",
        "assets_path" : "assets/",
        "docs_path" : "docs/"
    }        
}

If you are familiar with Composer already, you'll recognize the standard attributes, but what is different about this file is the "extra" attribute. Composer allows customizations there, and that's where Repoman looks for settings that are particular to it.

Clone this wiki locally