Chapter 1. Installation

1.x version
Maintained

Chapter 1. Installation

Installation Using Symfony Flex

Symfony Flex is the new way to manage dependencies on Symfony 3.3 and higher applications. If your project already uses Symfony Flex, execute this command to download, register and configure the bundle automatically:

1
$ composer require admin

Note

The above command creates a config/routes/easy_admin.yaml file to enable the routes of the bundle. Depending on your existing routing configuration, Symfony may ignore this configuration. Run the debug:router command to troubleshoot any problem with the application routes.

That's all! You can skip the rest of this chapter and go to the next chapter.

Installation without Symfony Flex

Installing EasyAdmin without Symfony Flex requires you to edit two files and execute two console commands:

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

1
$ composer require easycorp/easyadmin-bundle

This command requires you to have Composer installed globally, as explained in the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle(),
        );
    }

    // ...
}

Step 3: Load the Routes of the Bundle

Load the routes of the bundle by adding this configuration at the very beginning of the app/config/routing.yml file:

1
2
3
4
5
6
7
# app/config/routing.yml
easy_admin_bundle:
    resource: "@EasyAdminBundle/Controller/AdminController.php"
    type:     annotation
    prefix:   /admin

# ...

Step 4: Prepare the Web Assets of the Bundle

This bundle uses several CSS, JavaScript and font files to create the backend interfaces. Execute the following command to make those assets available in your Symfony application:

1
2
3
4
5
# Symfony 2
$ php app/console assets:install --symlink

# Symfony 3
$ php bin/console assets:install --symlink

That's it! Now everything is ready to create your first admin backend.


Next chapter: Chapter 2. Your First Backend

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