Symfony/Install Aimeos

From Aimeos documentation

Other languages:
English 100%

As composer based software library, the Aimeos web shop components are installed by the composer command. An introduction and documentation is available on the composer website.

The Aimeos Symfony bundle does a lot of the required setup itself after installation by using the post-install and post-update capabilities of composer. The only prerequisite to get this working is to add the main bundle class to the registerBundles() method in the app/AppKernel.php file:

  1. $bundles = array(
  2.     new Aimeos\ShopBundle\AimeosShopBundle(),
  3.     ...
  4. );

Also make sure that the database is set up and configured in your config.yml because the Aimeos web shop bundle will automatically create the required tables in the database or update the database table structure if necessary.

Then, add these lines to your composer.json in the root directory of your Symfony project:

  1.     "require": {
  2.         "aimeos/aimeos-symfony2": "~2017.07",
  3.         ...
  4.     },
  5.     "prefer-stable": true,
  6.     "minimum-stability": "dev",
  7.     "scripts": {
  8.         "post-install-cmd": [
  9.             "Aimeos\\ShopBundle\\Composer\\ScriptHandler::installBundle",
  10.             "Aimeos\\ShopBundle\\Composer\\ScriptHandler::updateConfig",
  11.             "Aimeos\\ShopBundle\\Composer\\ScriptHandler::setupDatabase",
  12.             ...
  13.         ],
  14.         "post-update-cmd": [
  15.             "Aimeos\\ShopBundle\\Composer\\ScriptHandler::installBundle",
  16.             "Aimeos\\ShopBundle\\Composer\\ScriptHandler::updateConfig",
  17.             "Aimeos\\ShopBundle\\Composer\\ScriptHandler::setupDatabase",
  18.             ...
  19.         ]
  20.     }

The additional line in the "require" section tells composer to install the Aimeos Symfony bundle in its latest version (dev-master). You can also use specific branch names if you don't want install always the latest version. Please have a look at the Aimeos Packagist page to find out what branches and versions are available.

To enable the use of the latest development version, you have to set the "minimum-stability" option to "dev". Otherwise, composer will stop with an error that the library dependency can't be resolved.

Composer provides means to do some of the necessary setup by scripts that are included in the bundles. The Aimeos bundle provides a script that automatically adds the required configuration to your YAML files and creates or updates the database tables used by Aimeos. This is enabled by adding the two lines


to both, the "post-install-cmd" and the "post-update-cmd" sections in the composer.json file stored in the root directory of your Symfony application.

In previous versions an additional section "repositories" was required in the composer.json file. This is not the case any more and have to be removed! Otherwise, composer will ask you for the credentials of a private repository that doesn't exist.

Afterwards, you can install the Aimeos shop bundle by executing this command on the command line:

composer update

In a production environment or if you don't want that the demo data gets installed, use the --no-dev option:

SYMFONY_ENV=prod composer update --no-dev

If no errors occurred and composer has finished its work, you can continue to adapt your base.html.twig template.

<< Previous: Upgrade from previous versions | Next: Adapt the base Twig template >>