geocodio/drone-ci-client

Simple, lightweight PHP client for Drone CI

dev-main 2023-04-27 09:59 UTC

This package is auto-updated.

Last update: 2024-11-27 13:16:44 UTC


README

Simple, lightweight PHP client for Drone CI

Installation

You can install the package via composer:

$ composer require geocodio/drone-ci-client

Using Laravel? Great! There's an optional Laravel service provider, for easy integration into your app.

Usage

$server = 'https://my-drone-ci-server.com';
$token = 'MyDroneAuthenticationToken';

$client = new Geocodio\Drone\Drone($server, $token);

$client->builds(string $owner, string $name);
$client->repo(string $owner, string $name);
$client->repoList();
$client->build(string $owner, string $name, int $num);
$client->buildLast(string $owner, string $name, string $branch = null);
$client->buildList(string $owner, string $name, array $options = []);
$client->promote(string $namespace, string $name, int $build, string $target, array $options = []);
$client->logs(string $owner, string $name, int $build, string $stage, int $step);

Usage with Laravel

This library works well without Laravel, but if you happen to be using Laravel you can enjoy a few Laravel-specific features.

The package will be auto-discovered by newer Laravel versions, so the only thing left to do is to publish the config file

php artisan vendor:publish --provider="Geocodio\Drone\DroneServiceProvider"

You can now go ahead and edit your config file at config/drone.php.

You will now be able to use the Drone facade, or dependency inject the fully-configured Drone class.

// Using facade
use Drone;

$builds = Drone::builds(string $owner, string $name);
// Using dependency injection
use Geocodio\Drone\Drone;

class SomeController {
  public function __construct(Drone $drone) {
      $builds = $drone->builds(string $owner, string $name);
  }
}

Testing

$ composer test

Changelog

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

Security

If you discover any security related issues, please email security@geocod.io instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.