2017 © Pedro PelĂĄez
 

library phabricator-php-api

PHP implementation for Phabricator conduit application

image

zolli/phabricator-php-api

PHP implementation for Phabricator conduit application

  • Thursday, March 30, 2017
  • by Zolli
  • Repository
  • 3 Watchers
  • 13 Stars
  • 2,921 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 3 Open issues
  • 6 Versions
  • 29 % Grown

The README.md

This repository is archived as 2021-07-01 because phabricator is no longer maintained.

---

Build Status Build Stability Code Coverage Scrutinizer Code Quality Test Results CRAP Report Dependency Status PHP7 Status, (*1)

Phabricator PHP API (Conduit client)

This is a PHP based client for Phabricator API. Phabricator is an open source, software engineering platform, built in PHP, and it has a very nice API called Conduit. For all available endpoint and method name, see the Conduit Application in the live Phabricator instance., (*2)

Basic useful feature list:, (*3)

  • Fully implemented all current API endpoint
  • Ability to make custom Client implementation
  • Custom handler class for each endpoint

Installation

With composer

Run this command inside your project, (*4)

composer require zolli/phabricator-php-api

Or past this dependency into your composer.json manually, (*5)

{
  "require": {
        "zolli/phabricator-php-api": "2.0.*"
    }
}

Documentation

Initialization

//Initialization the instance
$api = new \Phabricator\Phabricator('http://phabricator.example.com', 'cli-exmapletoken')

The API is now ready to use. This class uses magic method to proxy the calls to the suitable endpoint handler. Phabricator methods should looks like this: project.query. In this package exploded into two parts., (*6)

The first is the endpoint (Project in this example) and the method (query);, (*7)

With this example the call is looks like this:, (*8)

$result = $api->Project('query', ['status' => 'status-open']);

In this example the /api/project.query API is called and the status argument is passed., (*9)

Using custom client

This API of this package is allows you to make custom API clients that run the request for you. All client should implement the Phabricator\Client\ClientInterface interface., (*10)

Custom clients should be injected in two different way., (*11)

Injecting trough the constructor, (*12)

$myClient = \Vendor\Package\MyAwesomeApiClient();

$api = new \Phabricator\Phabricator('http://phabricator.example.com', 'cli-exmapletoken', $myClient);

Or you can use the Phabricator::setClient(ClientInterface $client) method., (*13)

$myClient = \Vendor\Package\MyAwesomeApiClient();

$api = new \Phabricator\Phabricator('http://phabricator.example.com', 'cli-exmapletoken');
$api->setClient($myClient);

Custom endpoint handlers

Handlers are various classes that handle the execution and post-processing of endpoint methods. By default all API endpoint have handler, but only the default that no do any pre- or post-processing., (*14)

By example a custom handler can read and write files when using the file.upload or file.download method., (*15)

To achieve this create a class that implements the \Phabricator\Endpoints\EndpointInterface and extends the \Phabricator\Endpoints\BaseEndpoint class and you good to go., (*16)

The BaseEndpoint provides a defaultExecutor() method that executed when an endpoint method not has any specific executor., (*17)

When creating custom executor method this methods will be used when calling an endpoint method., (*18)

Look the BaseEndpoint and any endpoint handler for more information., (*19)

Suppose that you created and endpoint handler with this FQCN: \Vendor\Package\Hander\FileHander; You can push this handler like this:, (*20)

Tha first argument is the endpoint name for this handler is listen and the second is the FQCN of the handler., (*21)

    $api = new \Phabricator\Phabricator('http://phabricator.example.com', 'cli-exmapletoken');

    $api->pushEndpointHandler('File', FileHandler::class);

Responses

The client is returning \Phabricator\Response\ConduitResponse as response. Look API documentation for methods., (*22)

Upgrading

From 1.0.0

In the 2.0.0 release the API is changed significantly and the underlying API dramatically. So, this release probably not compatible with components that created for 1.0.0, (*23)

Main API Differences:, (*24)

  • The \Phabricator\Phabricator constructor only take the baseUrl and the tokens as arguemnt
  • Client registration in constructor is now optional
  • Registering custom endpoint handler only require the handler Fully qualified class name, not instance
  • Instead of \stdClass responses now \Phabricator\Response\ConduitResponse objects.
  • The \Phabricator\Client\ClientInterface interface changed significantly.
  • The arguments of endpoint handler methods (executors) changed.
  • Now not using exceptions from global namespace, instead use buildr/foundation package exceptions
  • Clients not responsible for request data formatting.

API Documentation

The 2.0.0 release API documentation is available here: API Documentation, (*25)

Contribution

Project link, (*26)

For contribution guide and coding standard please visit our Coding Standard Repository, (*27)

Licensing

This project licensed under GNU - General Public License, version 3, (*28)

GPLv3 Logo, (*29)

The Versions

30/03 2017

v3.x-dev

3.9999999.9999999.9999999-dev

PHP implementation for Phabricator conduit application

  Sources   Download

GPL-3.0

The Requires

  • php >=7.0

 

The Development Requires

api client phabricator conduit

24/11 2016

dev-master

9999999-dev

PHP implementation for Phabricator conduit application

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

api client phabricator conduit

13/01 2016

2.0.2

2.0.2.0

PHP implementation for Phabricator conduit application

  Sources   Download

MIT

The Requires

 

The Development Requires

api client phabricator conduit

12/01 2016

2.0.1

2.0.1.0

PHP implementation for Phabricator conduit application

  Sources   Download

MIT

The Requires

 

The Development Requires

api client phabricator conduit

12/01 2016

2.0.0

2.0.0.0

PHP implementation for Phabricator conduit application

  Sources   Download

MIT

The Requires

 

The Development Requires

api client phabricator conduit

08/05 2015

1.0.0

1.0.0.0

PHP implementation for Phabricator conduit application

  Sources   Download

MIT

api client phabricator