sbs/symfony-adminlte-bundle

Symfony AdminLTE Integration Bundle

1.5.0 2019-12-10 10:58 UTC

This package is auto-updated.

Last update: 2020-02-10 11:23:58 UTC


README

Build Status

AdminLTE Bundle based on the AdminLTE Template for easy integration into Symfony. This bundle integrates several commonly used JavaScripts and Font-Awesome.

From version, the 1.5.x:

  • does not require AsseticBundle in since it deprecated.
  • was locked to version PHP 7.2.
  • was locked to symfony >=3.4

Installation

Installation using composer is really easy: Configure components installers directory in composer.json:

"extra": {
    "installer-types": ["library", "component"],
    "installer-paths": {
        "web/components/{$name}/": ["type:component"]
    },
},

After that run the next composer command to download and add bundle sbs/symfony-adminlte-bundle to your composer.json:

composer require sbs/symfony-adminlte-bundle

Configurations

Enable the bundle in your kernel:

<?php
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new SbS\AdminLTEBundle\SbSAdminLTEBundle(),
        new AppBundle\AppBundle(),
    );
}

Configure composer.json to install AdminLTE assets into bundle public directory.

Notice: insert line before Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets

"scripts": {
    "symfony-scripts": [
        "SbS\\AdminLTEBundle\\Composer\\ScriptHandler::buildAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
    ],
    "post-install-cmd": [
        "@symfony-scripts"
    ],
    "post-update-cmd": [
        "@symfony-scripts"
    ]
},

Add the following lines at app/config/routing.yml:

sbs_adminlte:
    resource: "@SbSAdminLTEBundle/Resources/config/routing.xml"

Notice for Symfony 2.8 and higher

For Symfony 3.4 and higher next snippet should be added to framework section.

framework:
    # ...
    templating:
        engines: ['twig']

Install Assets (run the following command):

For Symfony 2.8.*

php ./app/console assets:install

For Symfony 3.4.*

php ./bin/console assets:install

Changing default values template

If you want to change any default value as for example skin all you need to do is define the same at app/config/config.yml under [twig] section. See example below:

# Twig Configuration
twig:
    # ...
    globals:
        admin_lte_skin: skin-blue
    # ...

You could also define those values at app/config/parameters.yml:

app.skin: skin-blue

and then use as follow in app/config/config.yml:

# Twig Configuration
twig:
    # ...
    globals:
        admin_lte_skin: "%app.skin%"

AdminLTE skins are: skin-blue (default for this bundle), skin-blue-light, skin-yellow, skin-yellow-light, skin-green, skin-green-light, skin-purple, skin-purple-light, skin-red, skin-red-light, skin-black and skin-black-light. If you want to know more about theme then go ahead and check docs for AdminLTE.

There are a few values you could change for sure without need to touch anything at bundle, just take a look under Resources/views.

Next Steps

That's all. Enjoy.