PHP code example of codenzia / filament-gantt-lite
1. Go to this page and download the library: Download codenzia/filament-gantt-lite 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/ */
codenzia / filament-gantt-lite example snippets
namespace App\Filament\Pages;
use Codenzia\FilamentGanttLite\Pages\GanttLite;
class ProjectGantt extends GanttLite
{
protected static ?string $title = 'Project Schedule';
protected static ?string $slug = 'projects/gantt';
public static function shouldRegisterNavigation(): bool
{
return true;
}
protected function getGanttDataArray(?int $projectId = null, array $assigneeFilter = []): array
{
return Task::query()
->when($projectId, fn ($q) => $q->where('project_id', $projectId))
->get()
->map(fn (Task $t) => [
'id' => $t->id,
'name' => $t->name,
'start' => $t->start_date->toDateString(),
'end' => $t->due_date->toDateString(),
'progress' => $t->progress_percent,
'dependencies' => $t->dependencies->pluck('id')->all(),
])
->all();
}
}
return [
// 'Day' | 'Week' | 'Month'
'default_view_mode' => 'Week',
'bar_height' => 32,
'bar_corner_radius' => 8,
'padding' => 14,
'assets' => [
'js' => 'js/filament-gantt-lite.js',
'css' => 'css/filament-gantt-lite.css',
],
];
protected function getGanttSidebar(): array
{
return [
[
'id' => 'phase-1',
'label' => 'Phase 1 — Discovery',
'children' => [
['id' => 1, 'label' => 'Stakeholder interviews'],
['id' => 2, 'label' => 'Audit existing system'],
],
],
[
'id' => 'phase-2',
'label' => 'Phase 2 — Build',
'children' => [
['id' => 3, 'label' => 'Schema design'],
['id' => 4, 'label' => 'API endpoints'],
],
],
];
}
protected function getDefaultViewMode(): string
{
return 'Day'; // default 'Week'
}
protected function isBaselinesEnabled(): bool
{
return true; // render planned-vs-actual baseline bars
}
protected function getHolidays(): array
{
return ['2026-01-01', '2026-12-25'];
}
protected function getNonWorkingDays(): array
{
return [0, 6]; // Sunday + Saturday (default)
}
bash
php artisan vendor:publish --tag=filament-gantt-lite-config
bash
php artisan vendor:publish --tag=filament-gantt-lite-assets