tourze / easy-admin-extra-bundle
EasyAdmin扩展
Installs: 19
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.1
- doctrine/dbal: ^3.7.0 || ^4.0
- doctrine/orm: ^2.20 || ^3.0
- doctrine/persistence: ^3.1 || ^4
- easycorp/easyadmin-bundle: ^4
- phpdocumentor/reflection-docblock: ^5.4.0
- psr/log: ^3|^2|^1
- symfony/cache-contracts: ^3
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/event-dispatcher-contracts: ^2.5 | ^3
- symfony/framework-bundle: ^6.4
- symfony/http-foundation: ^6.4
- symfony/http-kernel: ^6.4
- symfony/serializer: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/easy-admin-attribute: 0.0.*
- tourze/enum-extra: ~0.0.5
- tourze/symfony-ecol-bundle: 0.0.*
- yiisoft/strings: ^2.1
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
- symfony/browser-kit: ^6.4
- symfony/phpunit-bridge: ^6.4
This package is auto-updated.
Last update: 2025-04-19 13:14:45 UTC
README
Extension bundle for EasyAdmin, providing utility features for working with Symfony EasyAdmin.
Features
- EntityDescriber: Read entity information, get property labels, column names, and field length.
- RepositoryTreeDataFetcher: Fetch and manipulate tree structure data from a repository.
- ChoiceService: Create options from enum types for form fields.
- ColumnService: Handle column-related functionality, especially for enum type columns.
- ImportService: Process import functionality, identify importable properties.
Requirements
- PHP 8.1+
- Symfony 6.4+
- Doctrine ORM 2.17 or 3.0+
Installation
Install the package via Composer:
composer require tourze/easy-admin-extra-bundle
Configuration
Add the bundle to your config/bundles.php
:
Tourze\EasyAdminExtraBundle\EasyAdminExtraBundle::class => ['all' => true],
Usage
EntityDescriber
This service reads entity information and provides methods to get property labels, column names, and field length.
use Tourze\EasyAdminExtraBundle\Service\EntityDescriber; class MyService { public function __construct( private readonly EntityDescriber $entityDescriber, ) { } public function example(\ReflectionProperty $property): string { // Get property label return $this->entityDescriber->getPropertyLabel($property); } }
ChoiceService
Create options from enum types for use in forms.
use Tourze\EasyAdminExtraBundle\Service\ChoiceService; class MyService { public function __construct( private readonly ChoiceService $choiceService, ) { } public function example(string $enumClass): array { // Create choices from enum return iterator_to_array($this->choiceService->createChoicesFromEnum($enumClass)); } }
RepositoryTreeDataFetcher
Fetch and process tree-structured data from repositories.
use Tourze\EasyAdminExtraBundle\Service\RepositoryTreeDataFetcher; class MyTreeService { public function __construct( private readonly RepositoryTreeDataFetcher $treeFetcher, ) { } public function getTreeData(string $entityClass): array { $this->treeFetcher->setEntityClass($entityClass); return $this->treeFetcher->genTreeData(); } }
Testing
Run tests using PHPUnit:
cd packages/easy-admin-extra-bundle
composer install
php vendor/bin/phpunit
Or from the monorepo root:
php vendor/bin/phpunit packages/easy-admin-extra-bundle
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This bundle is licensed under the MIT License. See the LICENSE file for details.