PHP code example of axyr / laravel-productive
1. Go to this page and download the library: Download axyr/laravel-productive 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/ */
axyr / laravel-productive example snippets
use Axyr\Productive\ProductiveFacade as Productive;
$tasks = Productive::tasks()->query()
->where('project_id', 31002)
->where('due_date', '>=', '2026-10-01')
->task->assignee()?->attribute('first_name');
}
$task = Productive::tasks()->create(new CreateTaskData(
title: 'Draft Q3 launch plan',
projectId: 31002,
taskListId: 7781,
dueDate: now()->addWeek(),
));
Productive::tasks()->update($task->id, new UpdateTaskData(dueDate: null)); // explicit null clears; omitted fields stay untouched
// Read
$task = Productive::tasks()->find(120501, ect_id', 1)->paginate(perPage: 50);
$count = Productive::timeEntries()->query()->where('person_id', 12)->count();
// Actions and bulk
Productive::tasks()->reposition($task->id, new RepositionTaskData(moveAfterId: 555));
Productive::timeEntries()->approve(84848214);
Productive::timeEntries()->bulkCreate([$entryA, $entryB]);
// Reports
Productive::reports()->timeReports()->query()
->group(TimeReportGroup::Person)
->where('after', '2026-09-01')
->all();
// Errors
try {
Productive::tasks()->create(['project_id' => 1]);
} catch (ValidationException $e) {
$e->first('title'); // "can't be blank"
}
bash
php artisan productive:ping
bash
php artisan vendor:publish --tag=productive-config