1. Go to this page and download the library: Download workplanner/work-planner 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/ */
use WorkPlanner\WorkPlannerServiceProvider;
$perPage = WorkPlannerServiceProvider::config('pagination')['per_page'] ?? 10;
use WorkPlanner\PackageInstaller;
use WorkPlanner\WorkPlannerServiceProvider;
$installer = new PackageInstaller('/path/to/host');
$installer->publish(WorkPlannerServiceProvider::TAG_CONFIG);
$installer->publishAll();
use WorkPlanner\Calendar\WorkingCalendar;
use WorkPlanner\DTO\ProjectInputDTO;
use WorkPlanner\Template\TemplateActivity;
use WorkPlanner\Template\TemplateCollection;
use WorkPlanner\Template\TemplateDependency;
use WorkPlanner\WorkPlanner;
$template = new TemplateCollection(workTypeId: 1, versionId: 1);
$template->addActivity(new TemplateActivity(1, 'Mobilization', 40.0, '#3498db', false, 5, 1));
$template->addActivity(new TemplateActivity(2, 'Handover', 60.0, '#9b59b6', true, 1, 2));
$template->addDependency(new TemplateDependency(1, 2));
$input = new ProjectInputDTO(
workTypeId: 1,
template: $template,
startDate: new DateTimeImmutable('2026-07-01'),
calendar: new WorkingCalendar([1, 2, 3, 4, 5]),
durationDays: 30,
);
$result = (new WorkPlanner())->generate($input);
echo $result->criticalPathDays;
foreach ($result->activities as $activity) {
echo $activity->name, ' ', $activity->startDate->format('Y-m-d'), PHP_EOL;
}
use WorkPlanner\Http\Controllers\ProjectController;
use WorkPlanner\WorkPlannerServiceProvider;
WorkPlannerServiceProvider::registerHostBridge(static function ($registry): void {
$registry->request($hostRequestAdapter);
$registry->response($hostResponseAdapter);
$registry->session($hostSessionAdapter);
$registry->authorization($hostAuthorizationAdapter);
$registry->views($hostViewFactory);
});
WorkPlannerServiceProvider::boot();