mangoweb/apiary-publisher

Apiary Blueprints 发布的 CLI 和 PHP 接口

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

This package is auto-updated.

Last update: 2024-08-29 04:03:33 UTC


README

Downloads this Month Stable version

Apiary Publisher 提供了一个简单的 CLI 和 PHP 接口,用于将 API 蓝图 发布到 Apiary

安装

使用 composer

$ composer require mangoweb/apiary-publisher

使用示例

Symfony 控制台

Mangoweb\ApiaryPublisher\Bridges\SymfonyConsole\ApiaryPublishCommand 注册到您的 Symfony 控制台应用程序中。

$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

命令行界面

# 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);

许可证

MIT。请参阅完整的 许可证