Wednesday, September 18, 2013

silverstripe CMS 3.1.0 and composer

This was new to me, so I actually struggled quite a bit with this. Now I think I have it more or less under control.

Installing composer

Open up a Terminal window and fire this command:

curl -sS https://getcomposer.org/installer | php

You might need to apply -d detect_unicode=Off after the php like this:

curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off

That if you don't wanna change your php.ini

Installing Git

Go to: http://git-scm.com/download/mac and download Git. Click it and click the pkg-file. Close your Terminal (cmd + q) and start it again. Write git and see that it works.

Using composer

Your silverstripe project has a composer.json file in the root. It might be empty.
I found this and pasted it into the file:

{
    "name": "silverstripe/installer",
    "description": "The SilverStripe Framework Installer",
    "require": {
        "php": ">=5.3.2",
        "silverstripe/cms": "*",
        "silverstripe/framework": "*",
        "silverstripe-themes/simple": "*"
    },
    "require-dev": {
        "silverstripe/compass": "*",
        "silverstripe/docsviewer": "*"
    },
    "minimum-stability": "dev"
}

In order to install, say silverstripe widgets I used this command:

> composer require silverstripe/widgets

You will be asked for a version, I chose dev-master (being the latest and greatest).
I actually had a hard time working out how the versioning works. But dev-master worked for me.

No comments:

Post a Comment