定制 cybercog/laravel-youtrack-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

cybercog/laravel-youtrack-sdk

Composer 安装命令:

composer require cybercog/laravel-youtrack-sdk

包简介

Laravel wrapper for PHP YouTrack SDK.

README 文档

README

cog-laravel-youtrack-sdk

Build StyleCI Code Climate Releases License

Introduction

Laravel wrapper for the PHP YouTrack REST library provides set of tools to interact with JetBrains YouTrack Issue Tracking and Project Management software.

Contents

Features

Requirements

  • YouTrack >= 3.0 with REST-API enabled (always enabled, by default)
  • PHP >= 8.1
  • Guzzle HTTP Client >= 7.0
  • Laravel >= 9.0

Installation

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

composer require cybercog/laravel-youtrack-sdk

Configuration

Laravel YouTrack SDK designed to work with default config, but it always could be modified. First of all publish it:

php artisan vendor:publish --tag="youtrack-config"

This will create a config/youtrack.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

YouTrack URL

YouTrack instance location could be defined in .env file:

YOUTRACK_BASE_URI=https://youtrack.custom.domain

Authorization methods

Starting with YouTrack 2017.1 release authorization based on permanent tokens is recommended as the main approach for the authorization in your REST API calls.

By default Token authorization will be used. You could redefine it in .env file:

Token authorization

YOUTRACK_AUTH=token
YOUTRACK_TOKEN=your-permanents-token

Cookie authorization

YOUTRACK_AUTH=cookie
YOUTRACK_USERNAME=username
YOUTRACK_PASSWORD=secret

Usage

Initialize API client

$youtrack = app(\Cog\Contracts\YouTrack\Rest\Client\Client::class);

As result instantiated \Cog\YouTrack\Rest\Client\YouTrackClient class should be returned.

API requests

HTTP request

$method = 'POST'; // GET, POST, PUT, DELETE, PATCH or any custom ones
$response = $youtrack->request($method, '/issue', [
    'project' => 'TEST',
    'summary' => 'New test issue',
    'description' => 'Test description',
]);

You can customize requests created and transferred by a client using request options. Request options control various aspects of a request including, headers, query string parameters, timeout settings, the body of a request, and much more.

$options = [
    'debug' => true,
    'sink' => '/path/to/dump/file',
];
$response = $youtrack->request('POST', '/issue', [
    'project' => 'TEST',
    'summary' => 'New test issue',
    'description' => 'Test description',
], $options);

HTTP GET request

$response = $youtrack->get('/issue/TEST-1');

HTTP POST request

$response = $youtrack->post('/issue', [
    'project' => 'TEST',
    'summary' => 'New test issue',
    'description' => 'Test description',
]);

HTTP PUT request

$response = $youtrack->put('/issue/TEST-1', [
    'summary' => 'Updated summary',
    'description' => 'Updated description',
]);

HTTP DELETE request

$response = $youtrack->delete('/issue/TEST-1');

API responses

Each successful request to the API returns instance of \Cog\Contracts\YouTrack\Rest\Response\Response contract. By default it's \Cog\YouTrack\Rest\Response\YouTrackResponse class.

Get PSR HTTP response

PSR HTTP response could be accessed by calling httpResponse method on API Response.

$youtrackResponse = $youtrack->get('/issue/TEST-1');
$psrResponse = $youtrackResponse->httpResponse();

Get response Cookie

Returns Set-Cookie headers as string from the HTTP response.

$apiResponse = $youtrack->get('/issue/TEST-1');
$cookieString = $apiResponse->cookie();

Get response Location

Returns Location header from the HTTP response.

$apiResponse = $youtrack->get('/issue/TEST-1');
$location = $apiResponse->location();

Transform response to array

$apiResponse = $youtrack->get('/issue/TEST-1');
$location = $apiResponse->toArray();

Get HTTP response status code

$apiResponse = $youtrack->get('/issue/TEST-1');
$location = $apiResponse->statusCode();

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Testing

Run the tests with:

vendor/bin/phpunit

Security

If you discover any security related issues, please email open@cybercog.su instead of using the issue tracker.

Contributors

@antonkomarev
Anton Komarev
sergiy-petrov

Laravel YouTrack SDK contributors list

Alternatives

Alternatives not found.

Feel free to add more alternatives as Pull Request.

License

About CyberCog

CyberCog is a Social Unity of enthusiasts. Research best solutions in product & software development is our passion.

CyberCog

cybercog/laravel-youtrack-sdk 适用场景与选型建议

cybercog/laravel-youtrack-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1k 次下载、GitHub Stars 达 19, 最近一次更新时间为 2017 年 05 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「rest」 「api」 「client」 「sdk」 「laravel」 「youtrack」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 cybercog/laravel-youtrack-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 cybercog/laravel-youtrack-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 cybercog/laravel-youtrack-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 2

GitHub 信息

  • Stars: 19
  • Watchers: 3
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-18