PHP code example of playtini / easy-admin-helper-bundle
1. Go to this page and download the library: Download playtini/easy-admin-helper-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
playtini / easy-admin-helper-bundle example snippets
#[ORM\Entity(repositoryClass: AuditLogRepository::class)]
#[ORM\HasLifecycleCallbacks]
#[ORM\Index(columns: ['created_at'])]
class AuditLog extends BaseAuditLog {}
AdminFormatter::badge('active', '#198754') // colored badge
AdminFormatter::badgeMap('error', $colorMap) // badge with color lookup
AdminFormatter::formatExpireDate($date) // color-coded by days remaining
AdminFormatter::formatHttpStatus(200) // Bootstrap status badge
AdminFormatter::formatBoolNullEmoji(true) // 🟢 / 🔴
AdminFormatter::muteZero(0) // grayed-out zero
AdminFormatter::percents(25, 100) // "25%"
class ClickCrudController extends AbstractCrudController
{
use CrudControllerTrait;
use QuickDateFilterCrudTrait;
public function configureCrud(Crud $crud): Crud {
return $this->_configureCrud($crud)
->overrideTemplate('crud/index', '@EasyAdminHelper/crud/quick_date_filter_index.html.twig');
}
public function createIndexQueryBuilder(...): QueryBuilder {
$qb = parent::createIndexQueryBuilder(...);
return $this->applyQuickDateFilter($qb);
}
}
class EventCrudController extends AbstractCrudController
{
use CrudControllerTrait;
use DateRangePickerCrudTrait;
public function configureCrud(Crud $crud): Crud {
return $this->_configureCrud($crud)
->overrideTemplate('crud/index', '@EasyAdminHelper/crud/date_range_picker_index.html.twig');
}
}
#[ReleaseSessionEarly]
public function export(): Response
{
// session already flushed by the time this runs
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.