maci/admin-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

maci/admin-bundle

Composer 安装命令:

composer require maci/admin-bundle

包简介

A Symfony Admin Generator Bundle by Maci

README 文档

README

Symfony Backends created with MaciAdmin

MaciAdminBundle lets you simply create administration backends for Symfony 4 applications.

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.

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.

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.

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.

Open the app/config/config.yml file and add the following configuration:

# 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:

Default MaciAdmin Backend interface

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

maci/admin-bundle 适用场景与选型建议

maci/admin-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 375 次下载、GitHub Stars 达 2, 最近一次更新时间为 2014 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「admin」 「Admin Generator」 「bootstrap」 「maci」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 maci/admin-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 maci/admin-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 maci/admin-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 375
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-04