Zi 字媒體
2017-07-25T20:27:27+00:00
Parse API Blueprint with Drafter
Version:v4.0.0-pre.4
Drafter 是一套以 C++ 開發,用來 parse API Blueprint 格式的 parser 套件。
Installation
Drafter 的安裝方式需要手動 Building。
# Clone the repo + fetch the submodules:
git clone --recursive git://github.com/apiaryio/drafter.git
cd drafter
# Build & test Drafter:
./configure
make test
# Add command
make drafter
sudo make install
Notice: 如果不是系統管理員,無法使用 sudo 的話,可以手動將 build/out/Release/drafter 複製到 ./bin/ 底下。
Usage
drafter --help
# Parse
drafter test.apib
PHP Wrapper
Drafter 也有其他相關的 Wrapper 可以使用,以下就以 PHP 的 Wrapper:drafter-php 為例。
首先,先透過 composer require 該套件:
composer require hmaus/drafter-php
使用範例
use Hmaus\DrafterPhp\Drafter;
// 需要代入 Drafter 的 bin 檔
$drafter = new Drafter('drafter/build/out/Release/drafter');
$refract = $drafter
->input('test.apib')
->format('json')
->run();
$phpArr = json_decode($refract, true);
其他細部操作可以參考套件的 Readme。
Categories: API Blueprint
Tags: API-BlueprintPHP
分類
Android
AngularJS
API Blueprint
Chrome
Database
MySQL
DataStructure
Editor
Vim
Firefox
Git
Hadoop
Language
Go
Java
JavaScript
jQuery
jQueryChart
Node.js
Vue
PHP
Laravel
ZendFramework
Python
Mac
Network
Cisco
DLink
Juniper
Oauth
Server
Apache
Share
Unix
FreeBSD
Linux
WebDesign
Bootstrap
CSS
HTML
Wordpress
Search
搜尋:
寫了
5860316篇文章,獲得
23313次喜歡