mangoweb/apiary-publisher

CLI and PHP interface for publishing Apiary Blueprints

dev-master 2016-04-26 12:16 UTC

README

Downloads this Month Stable version

Apiary Publisher provides a simple CLI and PHP interface for publishing API Blueprints to Apiary.

Installation

Use composer:

$ composer require mangoweb/apiary-publisher

Usage example

Symfony Console

Register Mangoweb\ApiaryPublisher\Bridges\SymfonyConsole\ApiaryPublishCommand to your Symfony Console application.

$app = new Symfony\Component\Console\Application();
$app->add(new Mangoweb\ApiaryPublisher\Bridges\SymfonyConsole\ApiaryPublishCommand);
# bin/console apiary:publish --name <apiName> --token <apiToken>                    <blueprintPath>
$ bin/console apiary:publish --name pollsapi  --token 874887d6ecd0b106a47448c5beca1 blueprint.apib

CLI

# apiary-publish <apiName> <apiToken>                    <blueprintPath>
$ apiary-publish pollsapi  874887d6ecd0b106a47448c5beca1 blueprint.apib

PHP

$apiName = 'pollsapi';
$apiToken = '874887d6ecd0b106a47448c5beca1';
$code = file_get_contents(__DIR__ . '/blueprint.apib');

$publisher = new ApiaryPublisher($apiName, $apiToken);
$publisher->publish($code);

License

MIT. See full license.