EasyAdmin 3 is released

EasyAdmin is an admin generator for Symfony applications. It helps you generate the backend of your projects by solving all the repetitive stuff (listing data, pagination, sorting, creating/updating entities, etc.)

EasyAdmin was created as a simpler (and less powerful) alternative to SonataAdmin. Originally, it took inspiration from symfony 1 admin generator and the entire backend was configured using a YAML file. This was nice for quickly creating backends, but made maintenance harder and creating complex backends nearly impossible.

A few days ago, after several months of hard work, EasyAdmin 3 was released. This new version is a complete revamp of the previous version. EasyAdmin no longer uses YAML and everything is configured with PHP code.

This is for example how to define a Dashboard that links to the CRUD operations (create, edit, list/show and delete) of some Doctrine entities:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
namespace App\Controller\Admin;

use App\Entity\Blog\Comment;
use App\Entity\Blog\Post;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;

class DashboardController extends AbstractDashboardController
{
    public function configureDashboard(): Dashboard
    {
        return Dashboard::new()->setTitle('ACME Inc.');
    }

    public function configureMenuItems(): iterable
    {
        yield MenuItem::section('Blog');
        yield MenuItem::linkToCrud('Posts', 'fa fa-file-text-o', Post::class);
        yield MenuItem::linkToCrud('Comments', 'far fa-comments', Comment::class);

        // ...
    }
}

EasyAdmin provides several commands to create the initial structure of these PHP classes (make:admin::dashboard, make:admin:crud). A key feature of the new EasyAdmin is that it stays as close to Symfony as possible. A “dashboard controller” is just a regular Symfony controller with a few custom methods, so you can use all Symfony controller features, you can access to your services, etc.

EasyAdmin uses tens of Symfony components, which provide an exceptional and rock-solid foundation to develop the project on top of them. This includes some of the newest components such as Symfony String and Symfony Uid. The String component is a personal favorite of mine because it allows you to write super clean and readable code:

1
2
// needed to turn 'foo' into '$foo' and 'foo.bar.baz' into '$fooBarBaz'
$newName = u($name)->replace('.', ' ')->camel()->collapseWhitespace()->toString();

This example is part of the migration command (make:admin:migration), which automatically turns the EasyAdmin 2 YAML configuration file into the PHP files used by EasyAdmin 3.

If you want to give EasyAdmin 3 a try in your project, run this command:

1
$ composer require easycorp/easyadmin-bundle:^3.0

You can also read EasyAdmin docs and visit the EasyAdmin blog, where you’ll find some technical articles explaining the most important changes made in this new version.

Thanks to all the developers who contributed to EasyAdmin 3 and thanks to the Symfony community in general for all their support.

Comments

This is a great timing. I'll try it out in a new project where some data has to be simply shown to the customer for the prototype. Looking foward to using EasyAdmin 3.
Great Work ! Thanks :)
I am very happy. The back office part has always been difficult following a different operation from the CRUD. Thank you very much Javier Eguiluz for this unforgettable contribution to the Symfony community
The config change is really useful. Thanks for your hard work.
Thank you Javier and all contributors!
Great Work
Nice to see this rewrite. Haven't got a chance to read through the v3 code itself but sounds like the right direction. I've created complex admin panel and applications based on sonata admin in the past and it was very powerful and a solid framework on top of symfony.

I've been away from symfony last couple of years, and after coming back and seeing easyadmin 2.x was absolute disappointment. It wasn't extensible, I found myself completely overwriting major parts of it for simple extend tasks. The codebase is in one Trait file..... sign....

Looking forward to trying out the v3.
Login with SymfonyConnect to post a comment