kachnitel/admin-bundle
最新稳定版本:0.2.0
Composer 安装命令:
composer require kachnitel/admin-bundle
包简介
Modern Symfony admin bundle powered by LiveComponents for Doctrine entities with extensive customization
README 文档
README
Modern Symfony admin bundle for managing entities
- Powered by Symfony's LiveComponents
- Minimal config
- Extensive customization capabilities
- Requires no front end libraries beyond Live Components
Documentation
- Configuration Guide - Configure entities with the
#[Admin]attribute - DataSource Abstraction - Display non-Doctrine data sources in the admin
- Column Filtering - Automatic per-column filters and customization
- Batch Actions Setup - Enable multi-select and bulk operations
- Asset Management - AssetMapper & Webpack Encore setup for Stimulus controllers
- Template Overrides Guide - Customize the admin interface appearance
- Development Guide - Running tests, code quality, and contributing
Features
- 🚀 LiveComponent-Ready: Built for Symfony UX LiveComponents
- 🎨 Template Override System: Hierarchical template resolution for easy customization
- 🔧 Type-Based Rendering: Smart property rendering based on Doctrine types
- 📝 Attribute-Driven: Modern PHP 8+ attribute configuration
- 🔍 Filters & Search: Built-in filtering and search capabilities
- ⚡ Batch Operations: Multi-select with Shift/Ctrl+Click and bulk delete
- 📊 Dashboard & Menu: Configurable admin dashboard and navigation
- 🔌 DataSource Abstraction: Display data from external APIs, audit logs, or any source
🏗️ Installation & Quick Start
1. Installation
composer require kachnitel/admin-bundle
The bundle is registered automatically by Symfony Flex. If not using Flex, enable the bundle manually in config/bundles.php:
return [ // ... Kachnitel\AdminBundle\KachnitelAdminBundle::class => ['all' => true], ];
2. Configure the Bundle
Create the bundle configuration file:
# config/packages/kachnitel_admin.yaml kachnitel_admin: base_layout: 'base.html.twig' # Your app's base template required_role: 'ROLE_ADMIN' # Role required to access admin (null for no restriction)
Note: The
kachnitel_admin:key must be present for the bundle to load. Usekachnitel_admin: ~for all defaults.
See the Configuration Guide for all available options.
3. Add Routes
Import the bundle's routes:
# config/routes/kachnitel_admin.yaml kachnitel_admin: resource: '@KachnitelAdminBundle/config/routes.yaml' prefix: /admin
4. Mark Entities with #[Admin] Attribute
Add the #[Admin] attribute to any Doctrine entity:
use Kachnitel\AdminBundle\Attribute\Admin; #[Admin(label: 'Products', icon: 'inventory')] class Product { // ... }
That's it! The entity will now appear in the admin dashboard at /admin.
5. Enable Batch Actions (Optional)
For multi-select and batch delete functionality, you'll need to:
-
Enable batch actions on your entity:
#[Admin(label: 'Products', enableBatchActions: true)] class Product { /* ... */ }
-
Register the Stimulus controller in your asset configuration
→ See the Batch Actions Setup Guide for complete setup instructions.
📋 Installation Summary
| Step | Automated by Flex | Manual Setup Required |
|---|---|---|
Bundle registration (bundles.php) |
✅ Yes | Only if not using Flex |
Config file (kachnitel_admin.yaml) |
✅ Creates template | Customize base_layout, required_role |
| Routes import | ✅ Creates file | Adjust prefix if needed |
Entity #[Admin] attribute |
❌ No | Add to each entity |
| Security/access control | ❌ No | Configure in security.yaml |
| Batch actions Stimulus controller | ❌ No | Manual registration in controllers.json |
| Template overrides | ❌ No | Create in templates/bundles/KachnitelAdminBundle/ |
| Form types for edit/new | ❌ No | Create form classes |
For template customization, see the Template Overrides Guide.
🛠️ Core Technology Stack
Kachnitel Admin is built purely on the established Symfony stack.
It relies only on Symfony, Doctrine ORM, and Live Components (part of the Symfony UX initiative) for all functionality and interactivity. This approach ensures the administration interface is built using server-side PHP without requiring any external JavaScript frameworks or frontend libraries.
DataSource Abstraction: While Doctrine entities work out-of-the-box with the
#[Admin]attribute, the bundle also supports custom data sources via theDataSourceInterface. This allows displaying data from external APIs, audit logs, or other non-Doctrine sources using the same admin UI. See the DataSource Guide for details.
Requirements
- PHP 8.2 or higher
- Symfony 6.4 or 7.0+
- Doctrine ORM 2.0 or 3.0+
License
MIT License - see LICENSE file for details.
统计信息
- 总下载量: 63
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-05