承接 k-bit/laravel-keeping 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

k-bit/laravel-keeping

Composer 安装命令:

composer require k-bit/laravel-keeping

包简介

A Laravel package to use the API of the Keeping time registration tool

README 文档

README

This is a simple library which can be used to communicate with timemanagement tool Keeping.

Installation

composer require k-bit/laravel-keeping

Add the following items to your .env file:

KEEPING_TOKEN="XXXXX"
KEEPING_ORGANISATION_ID="1234"

Example for creating a new time entry

The example below shows how you can create a new time entry in Keeping.

Import the required dependancies:

use KBit\LaravelKeeping\KeepingClient;
use KBit\LaravelKeeping\Model\TimeEntry;

Setup a connection with Keeping:


As a simple example, we now retrieve all the available projects, grab the first of them, and create a time entry for that project.:

See: https://developer.keeping.nl/#tag/reports/paths/~1{organisation_id}~1report/get

$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);

Example for getting a client-based report

The example below retrieves a report for a specific client. Please refer to the Keeping API documentation for a complete list of possible query options.

Import the required dependancies:

use KBit\LaravelKeeping\KeepingClient;
use KBit\LaravelKeeping\Model\Report;

Retrieve the report data:

$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);

TODO:

This package supports all of the API endpoints that are currently provided by the Keeping. There are some improvements that can be made in the future:

  • Adding support for Keeping's paginated responses
  • Adding validation to the query parameters arrays for various endpoints

统计信息

  • 总下载量: 35
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-03-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固