Installing the CMF sandbox
Installing the CMF sandbox¶
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. If you are looking for installation instructions for a development setup, please refer to:
- Installing the Standard Edition page for instructions on how to quickly install the CMF (recommended for development)
- Installing and Configuring the CMF Core Bundles for step-by-step installation and configuration details (if you want to know all the details)
As Symfony CMF Sandbox is based on Symfony2, you should make sure you meet the
Requirements for running Symfony2. Git 1.6+. The
php-intl extension is
also needed to follow the installation steps listed below.
Getting the Sandbox Code: Composer¶
The easiest way to install the CMF sandbox is is using Composer. Get it using
$ curl -sS https://getcomposer.org/installer | php
and then get the Symfony CMF code with it (this may take a while):
$ 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:
$ git clone git://github.com/symfony-cmf/cmf-sandbox.git <path-to-install> $ cd <path-to-install>
Change into the root folder of the sandbox and copy the default configuration files:
$ 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
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):
$ composer install
On Windows you need to run the shell as Administrator or edit the
composer.json and change the line
"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:
$ php bin/console doctrine:database:create
If you don't have sqlite, you can specify
provide the database name and login credentials to use.
Then you have to set up your database with:
$ php bin/console doctrine:phpcr:init:dbal --force
Once your database is set up, you need to register the node types for phpcr-odm:
$ 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.
$ 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.
In order to run the sandbox in production mode you need to generate the doctrine proxies and dump the Assetic assets:
$ 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.