2017 © Pedro Peláez
 

symfony-bundle admin-bundle

A Symfony Admin Generator Bundle by Maci

image

maci/admin-bundle

A Symfony Admin Generator Bundle by Maci

  • Monday, April 16, 2018
  • by maci1011
  • Repository
  • 2 Watchers
  • 0 Stars
  • 226 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

MaciAdminBundle

Symfony Backends created with MaciAdmin, (*1)

MaciAdminBundle lets you simply create administration backends for Symfony 4 applications., (*2)

Warning: this is an alpha version under development.

Missing:

  • tests
  • filters (but there is the search)
  • more examples in documentation
  • some other little thing

Features:

  • sections for differents roles
  • entities actions: list, new, trash, show, edit, relations, remove, uploader and reorder
  • entities relations: list, set/add, remove (item/association), uploader and reorder

Requirements

  • SUPPORTS SYMFONY 4.4
  • Doctrine ORM entities (Doctrine ODM and Propel not supported).

❮ NOTE ❯ you are reading the documentation of the bundle's development version., (*3)

Installation

Step 1: Download the Bundle

$ composer require maci/admin-bundle:dev-master

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

Step 2: Enable the Bundle

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Maci\AdminBundle\MaciAdminBundle(),
        );
    }

    // ...
}

Step 3: Load the Routes of the Bundle

# app/config/routing.yml
maci_admin:
    resource: "@MaciAdminBundle/Resources/config/routing.yml"
    prefix:   /mcm

# ...

Step 4: Set the thumbnails size for the "list" pages (for entities with a preview)

# Liip Configuration
liip_imagine:
    filter_sets:
        maci_admin_list_preview:
            quality: 80
            filters:
                thumbnail: { size: [90, 90], mode: inbound }

Step 5: Prepare the Web Assets of the Bundle

# Symfony 2.7
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., (*5)

Your First Backend

Creating your first backend will take you less than 30 seconds. Let's suppose that your Symfony application defines three Doctrine ORM entities called Product, Category and Page., (*6)

Open the app/config/config.yml file and add the following configuration:, (*7)

# app/config/config.yml
maci_admin:
    sections:
        all:
            dashboard: 'AppBundle:Default:my_dashboard.html.twig' # optional
            entities:
                product: 'AppEntityBundle:Product'
                category: 'AppEntityBundle:Category'
                page:
                    class: 'AppBundle:Page'
                    list: ['title', 'path', 'template', 'locale']
            config: # optional
                roles: [ROLE_ADMIN] # default

Congratulations! You've just created your first fully-featured backend! Browse the /mcm URL in your Symfony application and you'll get access to the admin backend:, (*8)

Default MaciAdmin Backend interface, (*9)

Full configuration

# app/config/config.yml
maci_admin:
    sections:
        medias:
            dashboard: 'AppBundle:Default:media_dashboard.html.twig' # optional
            entities:
                # in this example an entity 'media' is associated to an 'album' trough a 'media item'
                # then: Album >1toM< MediaItem >Mto1< Media
                # 'media', 'album' and 'media item' are here in a section named 'medias'
                album: 'AppBundle:Album'
                media: # an 'entity map'
                    bridges: [] # default
                    class: 'AppBundle:Media'
                    form: 'AppBundle\Form\Type\FormType'
                    label: 'Image' #example, default is the name of the section capitalized
                    list: ['_preview', 'name', 'type'] # columns in list views, default is [] (= all fields)
                    relations:
                        items:
                            # label and list are inherited from the 'entity map'
                            label: 'Image Items' #example
                            list: []
                            config: # -relation- config, inherited from the -entity- config:
                                enabled: true
                                roles: []
                                sortable: false # if true, in this example allow to sort the 'media items' of an 'album'
                                sort_field: 'position'
                                actions: []
                                trash: true
                                trash_field: 'removed'
                                uploadable: true
                                upload_field: 'file'
                    config: # -entity- config, inherited from the -section- config:
                        enabled: true
                        roles: []
                        sortable: false
                        sort_field: 'position'
                        actions: # default is []
                            list: 'AppBundle:Default:list.html.twig'
                            show:
                                controller: 'appbundle.controller'
                                template: 'AppBundle:Default:list.html.twig'
                            # actions are: list, show, new, trash, show, edit, relation, remove, uploader,
                            #   relations_list, relations_add, ('list' and 'add' for the sides of relations with multiple elements, like -MANY-toOne)
                            #   relations_show, relations_set ('list' and 'set' for the sides of relations with a single element, like -ONE-toMany),
                            #   relations_uploader (in this example this action can be used to directly upload some media in an album)
                        trash: true
                        trash_field: 'removed'
                        uploadable: true
                        upload_field: 'file'
                media_item:
                    class: 'AppBundle:MediaItem'
                    bridges: 'media' # or ['media', ...] in this example allow to add directly media to an album
            config: # -section- config, inherited from the -default- config:
                enabled: true
                roles: [ROLE_ADMIN]
                sortable: false
                sort_field: 'position'
                actions: []
                trash: true
                trash_field: 'removed'
                uploadable: true
                upload_field: 'file'
        # other optional sections
        blog:
            entities:
                post: 'AppBundle:Post'
                tag: 'AppBundle:Tag'
    config: # -default- config:
        controller: 'maci.admin.controller' # the service controller that contain the Action functions, see the ViewController for more informations
        enabled: true
        roles: [ROLE_ADMIN]
        sortable: false # if true, allow to sort items in the 'list' action, usually this is needed only in relations
        sort_field: 'position' # sort is made by field 'position'
        actions: []
        trash: true # allow to trash items of an entity
        trash_field: 'removed' # trash folder is filtered by field 'removed'
        uploadable: true
        upload_field: 'file'

License

This software is published under the MIT License, (*10)

The Versions

16/04 2018

dev-master

9999999-dev https://github.com/maci1011/MaciAdminBundle

A Symfony Admin Generator Bundle by Maci

  Sources   Download

MIT

The Requires

 

bootstrap bundle symfony admin admin generator maci

10/07 2017

v0.6.1

0.6.1.0 https://github.com/maci1011/MaciAdminBundle

Symfony MaciAdminBundle

  Sources   Download

MIT

The Requires

 

bootstrap admin admin generator maci

07/02 2017

v0.6

0.6.0.0 https://github.com/maci1011/MaciAdminBundle

Symfony MaciAdminBundle

  Sources   Download

MIT

The Requires

 

bootstrap admin admin generator maci