1. Go to this page and download the library: Download k-bit/laravel-keeping 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/ */
k-bit / laravel-keeping example snippets
use KBit\LaravelKeeping\KeepingClient;
use KBit\LaravelKeeping\Model\TimeEntry;
$keepingClient = new KeepingClient();
// If you don't provide an ID to the getUser function as the first parameter,
// your own user (== the one who is attached to your authorisation token) will
// be returned as a default.
$user = $keepingClient->getUser();
$project = $keepingClient->getProjects()->first();
// Create a time entry
$entry = new TimeEntry([
'user_id' => $user->id,
'project_id' => $project->id,
'date' => (new \DateTime)->format('Y-m-d'),
'purpose' => 'work',
'note' => 'Creating a new entry with laravel-keeping',
'hours' => 1,
]);
$keepingClient->postTimeEntry($entry);
use KBit\LaravelKeeping\KeepingClient;
use KBit\LaravelKeeping\Model\Report;
$clientId = 12345;
$reportQuery = [
'from' => '2021-01-01',
'to' => '2021-12-31',
'row_type' => Report::REPORT_ROW_TYPE_MONTH,
'client_ids' => [$clientId],
'page' => 1,
'per_page' => 100,
];
// Retrieve an overview of the hours made in each month
$summary = $keepingClient->getReport($reportQuery);
// Retrieves a Collection with TimeEntry models for all the entries that match the specified query variables.
$timeEntriesCollection = $keepingClient->getReportTimeEntries($reportQuery);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.