English spoken conference

Installing the CMF sandbox

1.3 version
Maintained Unmaintained

Installing the CMF sandbox

Tip

The CMF sandbox github repository contains a README file with an up to date installation instruction.

This tutorial shows how to install the Symfony CMF Sandbox, a demo platform aimed at showing the tool's basic features running on a demo environment. This can be used to evaluate the platform or to see actual code in action, helping you understand the tool's internals.

While it can be used as such, this sandbox does not intend to be a development platform. For a development setup, better set up a Symfony project starting from the Symfony CMF Standard Edition and then see cmf_core for step-by-step installation and configuration details (if you want to know all the details).

Requirements

As Symfony CMF Sandbox is based on Symfony, you should make sure you meet the Requirements for running Symfony. Git 1.6+. The php-intl extension is also needed to follow the installation steps listed below.

Installation

Getting the Sandbox Code: Composer

The easiest way to install the CMF sandbox is is using Composer. Get it using

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

and then get the Symfony CMF code with it (this may take a while):

1
2
$ composer create-project --no-install symfony-cmf/sandbox <path-to-install> '~1.2'
$ cd <path-to-install>

Getting the Sandbox Code: GIT

Alternatively you can get the sandbox from GIT. If you want to contribute to the sandbox, you need the GIT information. Just clone the repository from github:

1
2
$ git clone git://github.com/symfony-cmf/cmf-sandbox.git <path-to-install>
$ cd <path-to-install>

Configuration

Change into the root folder of the sandbox and copy the default configuration files:

1
2
$ cp app/config/parameters.yml.dist app/config/parameters.yml
$ cp app/config/phpcr_doctrine_dbal.yml.dist app/config/phpcr.yml

These two files include the default configuration parameters for the sandbox storage mechanism. You can modify them to better fit your needs

Note

The second configuration file refers to specific jackalope + doctrine dbal configuration. There are other files available for different PHPCR implementations.

Next, use composer to install the necessary bundles (this may take a while):

1
$ composer install

Note

On Windows you need to run the shell as Administrator or edit the composer.json and change the line "symfony-assets-install": "symlink" to "symfony-assets-install": "". If you fail to do this you might receive:

1
2
3
[Symfony\Component\Filesystem\Exception\IOException]
Unable to create symlink due to error code 1314: 'A required privilege is not held
by the client'. Do you have the required Administrator-rights?

Preparing the PHPCR Repository

Now that you have all the code, you need to setup your PHPCR repository. PHPCR organizes data in workspaces and sandbox uses the "default" workspace, which is exists automatically on a new repository.

Now you need to create the database. The default database specified in parameters.yml is sqlite. If you have the sqlite PHP extension, simply run:

1
$ php bin/console doctrine:database:create

If you don't have sqlite, you can specify pdo_mysql or pdo_pgsql and provide the database name and login credentials to use.

Then you have to set up your database with:

1
$ php bin/console doctrine:phpcr:init:dbal --force

Once your database is set up, you need to register the node types for phpcr-odm:

1
$ php bin/console doctrine:phpcr:repository:init

Import the Fixtures

The sandbox provides a set of demo content to show various use cases. They are loaded using the fixture loading concept of PHPCR-ODM.

1
$ php bin/console -v doctrine:phpcr:fixtures:load

This command loads fixtures from all bundles that provide them in the DataFixtures/PHPCR folder. The sandbox has fixtures in the MainBundle. Note that loading fixtures from non-default locations is possible as well, just not needed in this case.

Accessing your Sandbox

The sandbox should now be accessible on your web server.

1
http://localhost/app_dev.php

In order to run the sandbox in production mode you need to generate the doctrine proxies and dump the Assetic assets:

1
2
$ php bin/console cache:clear --env=prod --no-debug
$ php bin/console assetic:dump --env=prod --no-debug

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.