EasyAdminBundle for an Amazing Admin Interface

2:26:29
Buy Access

Tip: This course is built on Symfony 3, but most of the concepts apply just fine to Symfony 4.

Time to build an admin interface for your amazing site! You want it to be great! Powerful! Beautiful! Awe-inspiring! ... and you need to be able to finish it in a just a few hours!

Lucky you.

EasyAdminBundle allows you to spin up fully-featured admin interfaces with almost zero work, then customize them as far as you need to go. It's not only beautiful, powerful and awe-inspiring, it's fun to use. In this tutorial, we'll learn how to:

  • Install and Configure the bundle
  • Customize everything: what properties to display, how they render, help messages, sorting, filters... and more!
  • Override templates... at many different levels
  • Take control of your forms
  • Using autocompletion
  • Adding custom actions (and removing others)
  • Updating and configuring the menu (like adding a link to kitten videos!)
  • Hooking into events to do things before or after an entity is saved
  • Adding custom CSS/JS behaviors to the page
  • ... and more

Join us! This is a bundle you will not regret using!


Your Guides

Andrew Marcinkevičius Ryan Weaver

Questions? Conversation?

  • 2018-09-10 Diego Aguiar

    Hey gautam keshri

    You will have to create a custom action for doing all the "real" work, but, in your entity view, you will have to tweak its template in order to show that list and a button (or something) to submit the action

    Custom actions: https://symfony.com/doc/mas...
    And if you need an example of how to override a template, check this video: https://knpuniversity.com/s...

    Cheers!

  • 2018-09-07 gautam keshri

    I was just wondering how we can add mass action. For example
    a. Checkbox to select list (visible select /un-select and all select/un-select ) - then export
    b. Same checkbox to select list and then perform mass action like change value of is published
    (will take my entity scenario order and order Items , mass action to generate shipping AWB number which depends on third party service)

  • 2018-01-05 Victor Bocharsky

    Hey forsberg,

    Thanks for sharing your thoughts about SonataAdmin! Actually, I'm mostly agree with your thoughts. Well, most of the things that EasyAdminBundle allows to configure in yaml are simple, but it also allows you to extends a lot of features with PHP code. Anyway, we agree that SonataBundle is worth to be covered in our screencasts, and yes, we have it close in our idea pool, but its release won't be soon, at least, because we already have EasyAdminBundle :) But in the future we'll be glad to add a tutorial about it too. But to be honest, there're a lot of cool and interesting things we want to cover first before SonataBundle ;)

    Cheers!

  • 2018-01-04 forsberg

    Yhm, after months of working with Sonata Admin (our client loved it, mostly because it covered many features out of the box - and only because of this), I can't actually recommend this huge set of bundles, unless you don't plan to change much. Wanting to do some more serious and deeper changes than available out of the box will take from you a lot of time, when you'll be fighting tones of bugs and bad code of the Sonata. It tries to cover too many things, simply stating.

    On the other hand, I don't find Sonata Admin basics actually tougher than Easy Admin one's, maybe bit more config is needed, but everything is pretty logical there, except you configure everything rather through a seperate classes through plane PHP code (which gives you actually more possibilities than when everything is in config file). The entity admins are like extended FormType Symfony classes.

  • 2018-01-01 kotoko

    thank u sooo much

  • 2017-10-24 weaverryan

    Yo Cameron Burns!

    Haha, thanks for the question and *especially* the updates! I love the idea that future people can benefit if they have the same situation :). So yes, I think I like your situation. The basic issue is that you *can* of course configure a dql_filter on an entity section (https://knpuniversity.com/s.... But, unlike sorting, I do not believe there is a way to "trigger" this via a URL parameter. So, in order for this to work, you would need a custom action that reads some custom query parameter (or you just hard-code the filter you want for that controller) and overrides the query builder, exactly as you did. I suppose you could also override listAction and look for a query parameter to add extra filtering. Either way, it's basically the same thing.

    Two other possibilities would be to:

    A) Add a custom "section" that has a DQL filter and then link to that section - e.g. like the GenusHorde https://knpuniversity.com/s.... You would then need to control the menu (https://knpuniversity.com/s... because you probably do not want this section to display.

    B) You might be able to re-use the "search" action. Basically, link to the search action with a search term that filters the list. This is pretty simple, but not as flexible as defining a DQL filter that you control.

    Cheers!

  • 2017-10-23 Cameron Burns

    UPDATE #2: I figured it out. For anyone else; it was to override the AlbumController (so we can create a custom route with an ID field as a parameter and then to override the createListQueryBuilder() to add the right DQL where statement.

    Ryan, this would make an awesome tutorial; displaying a sub-list of entities based on a parent entity is a common admin need.
    all the best!

  • 2017-10-23 Cameron Burns

    UPDATE: it looks like this would involve defining a custom controller which would handle the query and then use the same twig layout and list twig files. The custom query controller would need to handle pagination...

  • 2017-10-23 Cameron Burns

    I should mention this also; related to DQL

    Can you pass in a parameter to be used in a DQL filter?

    I thought this would be a typical use case of easy admin - and likely a useful video (but not currently covered by KNPU training). As an example: display a list of photo albums that provide a link to a DQL filtered page that show a list of only the photos in that album.

  • 2017-10-23 Cameron Burns

    Hi Ryan, thanks for the great videos :-)

    Question: how do you generate a route (on a entity list page) to a easy admin menu item using the router service?
    >> in particular to a page that has DQL (as this isn't simply specifying the entity and list|form type > I'd like to generate a URL to a menu item that uses DQL)

    (Searching I've done: I CTRL-F'ed "router" and "generate" on all your tutorial pages and googled this but wasn't able to find an answer - I also looked at the AdminController.php > indexAction() from easy admin, but it seems to only accept "entity" and "action" - not allowing to specifying a DQL page.)

    Any help appreciated :-)

  • 2017-08-11 Victor Bocharsky

    Hi Lopoi,

    Well, this course uses our AquaNote theme on which we were working in some Symfony tutorials like:
    http://knpuniversity.com/sc...
    http://knpuniversity.com/sc...

    The last is "Doctrine Collections" I think, but it's probably not very important because we often make some changes after previous course before starting a new course, so better to download the initial course code and start from the "start/" folder - you can download initial course code of this tutorial with "Download" button -> "Course Code" in the right up corner of any chapter's page of this course. But to download the course code you need to have a paid KnpU subscription or own the course.

    Cheers!

  • 2017-08-11 Lopoi Popoi

    Hello @wweaverryan !
    You have recommended to start this course with downloading source code. Can you please tell from which of the previous course this code come from?
    Thanks!

  • 2017-07-06 Diego Aguiar

    Hey Riccardo Previti

    There is a way to pass options to the Form types by using the field *type_options*, you can use it something like this (copied from the docs):


    easy_admin:
    entities:
    Customer:
    class: AppBundle\Entity\Customer
    new:
    fields:
    - { property: 'name', icon: 'user' }
    - { property: 'email', css_class: 'input-large', type_options: { required: false } }

    you can read more info about it here https://github.com/javiereg...

    Cheers!

  • 2017-07-06 Riccardo Previti

    I'm trying to use EasyAdminBundle together with FOSUserBundle. When admin-editing a user, date selection form only displays 5 years in the past. This is unsuitable for the birthDate field. How can I extend it?

  • 2017-07-05 Victor Bocharsky

    Hey zboina ,

    We didn't work due to 4th of July. We're going to upload more videos today, so today... or maybe tomorrow you will see it.

    Cheers!

  • 2017-07-04 zboina

    Waiting impatiently for the next part of the course ...
    You have not posted anything since Friday...

  • 2017-06-27 Luis

    Sonata Admin would be awesome! Think about it, weaverryan .

  • 2017-06-21 weaverryan

    Woohoo! Hopefully we'll start releasing next week - the first 6 chapters are already in final editing :)

  • 2017-06-21 zboina

    Hello!
    Very good idea with EasyAdmin course!
    When will the course be available?

    Regards!

  • 2017-05-25 Victor Bocharsky

    Hm, probably you cleared the cache as Diego had suggested and then ran assets:install again which did the trick. Anyway, glad it works! ;)

    Cheers!

  • 2017-05-25 Mykyta Popov

    I'm working on debian with homestead.
    My problem is gone, but I don't know why)))))
    I just have try to run server from the console bin/console server:start and admin styles were found
    then I tried to run vagrant server again and every thing became ok...
    I didn't touch cache or some thing else.. magic...

  • 2017-05-25 Victor Bocharsky

    Hey Mykyta,

    Are you on Windows? What version of Windows do you have? Try do not use --symlink, i.e. run just "php bin/console assets:install", but first of all clear the both prod and dev cache. Does it fix your problem? Are you sure you have "web/bundles/easyadmin/stylesheet/easyadmin-all.min.css" file exist in this path?

    Cheers!

  • 2017-05-24 Mykyta Popov

    unfortunately cache:clear and ctrl+f5 does not work for me((

  • 2017-05-24 Diego Aguiar

    Hey Mykyta Popov

    That's odd, can you try clearing your cache "bin/console cache:clear" and also browser's cache too "CTRL + F5" (in chrome)
    If it doesn't work, let us know

    Have a nice day!

  • 2017-05-24 Mykyta Popov

    Im sorry, but dont know where to ask the question.
    My problem is with css and js files.
    I have made the installation step by step like here http://symfony.com/doc/curr...
    After bin/console assets:install --symlink command everything looks ok but chrome console is shows errors that files are not found GET /bundles/easyadmin/javascript/easyadmin-all.min.js GET /bundles/easyadmin/stylesheet/easyadmin-all.min.css GET /http://knp2.local/bundles/easyadmin/javascript/easyadmin-all.min.js
    I have checked and they are there...
    Could you explain me what I have miss?

  • 2017-05-17 weaverryan

    Hey Lopoi Popoi!

    Unfortunately, it won't cover this... mostly because I don't believe that EasyAdminBundle has any feature related to this. Aka, you would need to do it yourself. I think SonataAdminBundle has something like this... but that's a totally different library (which I currently recommend cautiously, because historically, it is quite complex).

    Cheers!

  • 2017-05-16 Lopoi Popoi

    Will it cover adding not single image to the record but kind of multi upload gallery?

  • 2017-05-14 weaverryan

    Hey Patrick Savelberg

    Between the http://knpuniversity.com/sc... tutorial and this one, we should have that covered... at least mostly ;). At some point, the collection stuff is so complex, building a custom, AJAX-ified setup might be better. But, all depends on your situation!

    Cheers!

  • 2017-05-11 Patrick Savelberg

    Form Collections would be awesome

  • 2017-05-09 Andrew M.

    Cool. We will discuss this with Ryan to see that can be done about it.

  • 2017-05-09 Ahmed EBEN HASSINE

    It's about having a real homepage for our backend ,I dont know how to implement the solution with easyadmin ,because everything should be configured . Anyway, all we need is an empty homepage.html.twig template, where we will render some informations from our controller
    maybe some charts, widgets and advanced stuff that we can see in the admin/backend templates.

    Thank you for taking serious my proposition.

  • 2017-05-06 Andrew M.

    Both would be a great additions to tutorial Ahmed EBEN HASSINE thanks

    CVS export is clear. Could you give some details about what you would like to see in a dashboard page?

  • 2017-05-05 Ahmed EBEN HASSINE

    Thank you weaverryan for replaying i really appreciate your work, please at least the first point about the landing page(dashboard) , it's really importing .

  • 2017-05-05 weaverryan

    Great suggestions Ahmed EBEN HASSINE! This tutorial is just about ready to be recorded, but I'll see if these can fit in :).

    Cheers!

  • 2017-05-05 Ahmed EBEN HASSINE

    Can you please add to your plans :
    + How to make a landing page (dashboard) for easyadmin because currently, EasyAdmin doesn't have a real backend homepage. When you access the backend, you are redirected to the list action of the first configured entity .
    + Export data into csv file .

  • 2017-04-20 weaverryan

    Zuhayer Tahir Haha, "slayed tutorialically" <= yep, that's my favorite new phrase :).

    Right now, we have no plans on covering this. I don't have extensive experience with Sonata, but everyone says the same thing: big huge, complex bundle. I'd rather everyone use EasyAdminBundle and enjoy themselves. If there are some things that Sonata can do that EasyAdminBundle can't, hopefully those could be added to EasyAdminBundle or extracted into a smaller new bundle independent of Sonata. But, maybe I'm underestimating Sonata and it's got some value. If I can be convinced, then we might do it - it is still one of the most used bundles out there!

    Cheers!

  • 2017-04-20 Zuhayer Tahir

    Any plan for a course on Sonata Admin?
    Sonata is a Giant Dragon which needs to be slayed tutorialically by Shriek(s) or Princess Fiona(s) :)