1. Go to this page and download the library: Download spatie/laravel-float-sdk 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 Spatie\FloatSdk\FloatClient;
public function __construct(protected FloatClient $float) {}
public function index()
{
$users = $this->float->users()->all();
}
$user = $float->users()->get(1);
// Without filters
$users = $float->users()->all();
// With filters
use Spatie\FloatSdk\QueryParameters\GetUsersParams;
$users = $float->users()->all(
new GetUsersParams(
active: true,
departmentId: 5,
)
);
$project = $float->projects()->get(10);
// Without filters
$projects = $float->projects()->all();
// With filters
use Spatie\FloatSdk\QueryParameters\GetProjectsParams;
$projects = $float->projects()->all(
new GetProjectsParams(
clientId: 10,
tagName: 'Design',
fields: ['id', 'name'],
expand: ['client'],
)
);
$task = $float->projectTasks()->get(1);
// Without filters
$tasks = $float->projectTasks()->all();
// With filters
use Spatie\FloatSdk\QueryParameters\GetProjectTasksParams;
$tasks = $float->projectTasks()->all(
new GetProjectTasksParams(
projectId: 42,
billable: true,
fields: ['id', 'name'],
)
);
$client = $float->clients()->get(1);
// Without filters
$clients = $float->clients()->all();
// With filters
use Spatie\FloatSdk\QueryParameters\GetClientsParams;
$clients = $float->clients()->all(
new GetClientsParams(
fields: ['id', 'name'],
expand: ['projects'],
)
);
$allocation = $float->allocations()->get(1);
// Without filters
$allocations = $float->allocations()->all();
// With filters
use Spatie\FloatSdk\QueryParameters\GetAllocationsParams;
$allocations = $float->allocations()->all(
new GetAllocationsParams(
projectId: 10,
startDate: '2025-01-01',
endDate: '2025-12-31',
)
);
// Fetch time off entries within a date range
$timeOffs = $float->timeOff()->all('2025-01-01', '2025-12-31');
$timeOffTypes = $float->timeOff()->types();
// Fetch public holidays for a specific year
$holidays = $float->publicHolidays()->all(2025);
use Spatie\FloatSdk\QueryParameters\GetUsersParams;
new GetUsersParams(
page: 2,
perPage: 25,
sort: 'name'
);
use Spatie\FloatSdk\QueryParameters\GetProjectsParams;
new GetProjectsParams(
fields: ['id', 'name', 'client_id']
);
use Spatie\FloatSdk\QueryParameters\GetProjectsParams;
new GetProjectsParams(
expand: ['client']
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.