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

Rather than relying on its own config file, Repoman ties into composer's config file (composer.json). Repoman relies on attributes added to the "extra" node. This page features sample composer.json configuration files.

Basic composer.json File

As a reference, here is a standard composer.json file, one that has nothing to do with Repoman whatsoever:

{
    "name": "vendorname/packagename",
    "description": "My Description",
    "type": "library",
    "keywords": ["modx","extra","debug"],
    "homepage": "github.com/vendorname/packagename",
    "license": "GPL-2.0+",
    "authors": [
        {
            "name": "Some Body",
            "email": "somebody@doe.org",
            "homepage": "http://somebody.com"
        }
    ],
    "support": {
        "email": "support@example.org",
        "issues": "http://github.com/vendorname/packagename/issues",
        "forum": "http://forums.modx.com/",
        "wiki": "http://github.com/vendorname/packagename/wiki",
        "source": "https://github.com/vendorname/packagename"
    },    
}

Repoman composer.json File

Here is an example of a more thorough composer.json file, including some Repoman-specific attributes in the "extra" node:

{
    "name": "craftsmancoding/bloodline",
    "description": "Bloodline is a debugging tool for MODX Revolution that lets you track a rendered page back to its component parts, trace-out any tag, and view information and errors on any page.",
    "type": "library",
    "keywords": ["modx","composer","repository","manager","autoload","git"],
    "homepage": "https://github.com/craftsmancoding/bloodline",
    "license": "GPL2",
    "authors": [
        {
            "name": "Everett Griffiths",
            "email": "everett@craftsmancoding.com",
            "homepage" : "https://github.com/craftsmancoding/bloodline"
        }        
    ],
    "support": {
        "email": "donotreply@craftsmancoding.org",
        "issues": "https://github.com/craftsmancoding/bloodline/issues",
        "forum": "http://forums.modx.com/",
        "wiki": "https://github.com/craftsmancoding/bloodline/wiki",
        "source": "https://github.com/craftsmancoding/bloodline"
    },    
    "require": {
        "php": ">=5.3",
        "michelf/php-markdown": "1.4.0"
    },
    "autoload": {
        "classmap":["model/bloodline/"]
    },
    "extra": {
        "package_name": "Bloodline",
        "namespace": "bloodline",
        "version": "1.0.2",
        "release": "pl",
        "category":"Bloodline",
        "core_path": "",
        "assets_path" : "assets/",
        "docs_path" : "docs/"
    }
}

Massive composer.json Example

Here is an example of a composer.json from Moxycart. It features a long list of build-attributes for describing how seed-data for its custom tables should be packaged.

{
    "name": "craftsmancoding/moxycart",
    "description": "A turnkey FoxyCart eCommerce solution for MODX Revolution.",
    "type": "library",
    "keywords": ["modx", "foxycart", "ecommerce"],
    "homepage": "github.com/craftsmancoding/moxycart",
    "license": "GPL-2.0",
    "authors": [
        {
            "name": "Everett Griffiths",
            "email": "everett@craftsmancoding.com",
            "homepage": "http://craftsmancoding.com"
        },
        {
            "name": "Nick Hoag",
            "email": "nick@craftsmancoding.com",
            "homepage": "http://craftsmancoding.com"
        },
        {
            "name": "Daniel Edano",
            "email": "daniel@craftsmancoding.com",
            "homepage": "http://craftsmancoding.com"
        }        
    ],
    "support": {
        "email": "donotreply@craftsmancoding.org",
        "issues": "http://github.com/craftsmancoding/moxycart/issues",
        "forum": "http://forums.modx.com/",
        "wiki": "http://github.com/craftsmancoding/moxycart/wiki",
        "source": "https://github.com/craftsmancoding/moxycart"
    },    
    "require": {
        "php": ">=5.3",
        "ezyang/htmlpurifier": "dev-master"
    },
    "autoload": {
        "classmap":["model/moxycart/"]
    },
    "extra": {
        "package_name": "Moxycart",
        "namespace": "moxycart",
        "version": "0.8.1",
        "release": "dev",
        "category":"Moxycart",
        "core_path": "",
        "assets_path" : "assets/",
        "seeds_path": ["model/seeds/base"],
        "packages":[
            {
                "pkg":"moxycart",
                "path":"model/",
                "table_prefix": "moxy_"
            },
            {
                "pkg":"foxycart",
                "path":"model/",
                "table_prefix": "foxy_"
            }
        ],
        "build_attributes":{
            "Currency": {
                "preserve_keys":true,
                "update_object":true,
                "unique_key":true
            },
            "Product": {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": "sku"
            },
            "Image": {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": "url"
            },
            "Spec": {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": "identifier"
            },
            "ProductSpec": {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": ["product_id","spec_id"]
            },
            "VariationTerm" : {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": ["vtype_id","name"]
            },
            "VariationType" : {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": ["name"]
            },    
            "Store": {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": ["uri"],
                "related_objects": true,
                "related_object_attributes": {  
                    "Products": {
                        "preserve_keys": true,
                        "update_object": true, 
                        "unique_key": ["sku"],
                        "related_objects": true,
                        "related_object_attributes": {
                            "Specs": {
                                "preserve_keys": true,
                                "update_object": true, 
                                "unique_key": ["product_id","store_id"],
                                "related_objects": true,
                                "related_object_attributes": {            
                                    "Spec" : {
                                        "preserve_keys": false,
                                        "update_object": true, 
                                        "unique_key": ["identifier"]
                                    }    
                                }                
                            },           
                            "Template": {
                                "preserve_keys": false,
                                "update_object": true,
                                "unique_key": "templatename"
                            }
                        }
                    }
                }         
            },
            "Review": {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key" : ["email"]
            },        
            "Transaction": {
                "preserve_keys": true,
                "update_object": true, 
                "unique_key": ["transaction_id"]
            }
        }
    }
}

Clone this wiki locally