Skip to content
Backlog(Nulab,inc.) API v2 wrapper.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
src
tests
.gitignore
.travis.yml
LICENSE
README.md
composer.json
extend.functions.php
phpunit.xml.dist

README.md

backlog-client

It internally uses Symfony HttpClient component.

Usage

<?php
require __DIR__ . '/vendor/autoload.php';

use Chanshige\Backlog\Factory;
use Symfony\Contracts\HttpClient\ResponseInterface;

/** @var \Chanshige\Backlog\Provider\ResourceProvider $backlog */
$backlog = (new Factory)->newInstance(
    'space.backlog-uri.example',
    'your-api-key'
);

/** スペース情報の取得 [GET] **/
$space = $backlog->space();

try {
    /**
     * @var ResponseInterface $response 
     */
    $response = $space->get();

    // HTTP status code
    $statusCode = $response->getStatusCode();
    
    // Response body as a string
    $body = $response->getContent();
    
    // Response body decoded as array, typically from a JSON payload.
    $toArray = $response->toArray();
} catch (Throwable $e) {
    echo $e->getMessage();
}

/** 課題の追加 [POST] */

// POSTするパラメーターの配列を生成
$param = new \Chanshige\Backlog\Collection\ArrayList();
$param->set('projectId', 123456)
    ->set('summary', 'api_post')
    ->set('issueTypeId', 123456)
    ->set('priorityId', 3);

// withParameters メソッドにセット
$issues = $backlog->issues()->withParameters($param);

try {
    //POST request.
    $response = $issues->post();
    
    // Response body as a string
    $body = $response->getContent();
} catch (Throwable $e) {
    echo $e->getMessage();
}

QA

composer test  // run unit test with coverage
composer cs    // fix the coding standard (dry-run)

License

MIT

Author

chanshige

You can’t perform that action at this time.