Content Management System bundle for symfony 2

1.3.10 2018-09-20 19:15 UTC


Content Management System for integration in (existing) Symfony 3 projects.

Easy to connect with your own security and user management (bundle).


Step 1: Composer

Add KRSolutionsKRCMSBundle to your composer.json

    "require": {
        "kr-solutions/krcms-bundle": "~1",

also add component-dir under config node of composer.json

    "config": {
        "component-dir": "web/assets"

Now tell composer to download the bundle by running the command:

composer update kr-solutions/krcms-bundle

Step 2: Enable the bundle

Enable the bundle in the kernel:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new KRSolutions\Bundle\KRCMSBundle\KRSolutionsKRCMSBundle(),
        new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
        new FM\ElfinderBundle\FMElfinderBundle(),
        // ...

Step 3: Import KRSolutionsKRCMSBundle routing files

Problably before all your other routing, but after your security routing, insert:

(you can change the prefix, but remember to use the same prefix in the next step (security.yml)).

# app/config/routing.yml
    resource: "@KRSolutionsKRCMSBundle/Resources/config/routing_admin.yml"
    prefix:   /cms

    resource: "@KRSolutionsKRCMSBundle/Resources/config/routing.yml"
    prefix:   /

Step 4: Configure your application's security.yml

Secure the CMS with access_control, you can use your own roles here:

# app/config/security.yml

        - { path: ^/cms/, role: ROLE_USER }

Step 5: Minimal configuration

This bundle needs to know which user class to use for cms users. This can be your own, using your own login screens etc.

This user class has to have an identifier field called 'id' for it's relationships. If you are using another primary field name: bad luck. Try to change it or fork this bundle.

# app/config/config.yml

# Enable the translator
    locale: en

    translator:      { fallbacks: ["%locale%"] }

# KRSolutionsKRCMSBundle configuration
    db_driver: orm # Currently only the orm driver is supported
        user_class: AppBundle\Entity\User

Step 6: Install assets & update the database schema

php bin/console assets:install --relative
php bin/console doctrine:schema:update --force

Optional: Implement custom username implementation for display in this CMS

The system is trying to find out the username for display in the CMS by trying to get the following methods from the user class:

  • getKRCMSUsername()
  • getUsername()
  • getId()