garethmidwood/codebasehq-php
Composer 安装命令:
composer require garethmidwood/codebasehq-php
包简介
A PHP library for the CodebaseHQ API
README 文档
README
A PHP library for the CodebaseHQ API
Note
This library creates objects for users, projects, tickets etc. When you make a query to retrieve tickets (this is just an example, it can apply to other classes too) it will attempt to look up the users and link the ticket assignee/reporter with the user. If you haven't already retrieved users then your ticket will have no assignee or reporter assigned to it. Because of this, the best steps to take are:
- retrieve users
- retrieve projects
- retrieve tickets for the project
- retrieve time sessions for the project
Instructions for each of these steps can be found below.
Usage
Connecting to the API
In order to connect to and query the codebase API you need to create a CodebaseHQAccount object
$codebaseHQ = new GarethMidwood\CodebaseHQ\CodebaseHQAccount( $apiUser, $apiKey, $apiHost );
Retrieving All Users
Users are pulled at the account level
$users = $codebaseHQ->users();
This returns a User\Collection - searching should be done on the collection, the class has a few helper methods for this
Retrieving Projects
Projects can be pulled as a whole for the account, or individually by permalink.
Retrieving All Projects
Projects are also pulled at the account level
$projects = $codebaseHQ->projects();
This returns a Project\Collection - searching should be done on the collection, the class has a few helper methods for this
Retrieving Individual Projects
You can pull an individual project by the permalink (note the method name is singular)
$project = $codebaseHQ->project('project-permalink');
This returns a Project\Project - not a collection
Populating Project Details
Projects can be populated with all of their categories, priorities, statuses and types.
$codebaseHQ->categories($project); $codebaseHQ->priorities($project); $codebaseHQ->statuses($project); $codebaseHQ->types($project);
Retrieving Tickets for a Project
Tickets can only be retrieved if you have a Project\Project object.
$codebaseHQ->tickets($project, $pageNo); $project->getTickets();
The tickets method returns a boolean indicating whether there are further results (as the results are paginated).
The tickets themselves are added to a Ticket\Collection in the project. As always, searching should be done on the collection, the class has a few helper methods for this
Pagination
Tickets are paginated, with 20 per page. You can write a simple loop to pull all tickets for the project
$pageNo = 1; $moreResultsToRetrieve = true; while ($moreResultsToRetrieve) { $moreResultsToRetrieve = $codebaseHQ->tickets($project, $pageNo); $pageNo++; }
Retrieving Time Sessions for a Project
Time Sessions can only be retrieved if you have a Project\Project object.
You must also pass through a period to retrieve the times for, this can be a day/week/month or all - classes exist for each one.
// can be All|Day|Week|Month $period = new GarethMidwood\CodebaseHQ\TimeSession\Period\Week; $codebaseHQ->times($project, $period);
Time sessions will be associated with the project, the ticket and the user if you have populated those collections.
// times for the project $project->getTimeSessions(); // times associated to a user $user->getTimeSessions(); // times associated to a ticket $ticket->getTimeSessions();
garethmidwood/codebasehq-php 适用场景与选型建议
garethmidwood/codebasehq-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 garethmidwood/codebasehq-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 garethmidwood/codebasehq-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-02-26