2017 © Pedro Peláez
 

library oasis-mson-parser

An MSON parser for PHP

image

brianseitel/oasis-mson-parser

An MSON parser for PHP

  • Monday, May 23, 2016
  • by brianseitel
  • Repository
  • 1 Watchers
  • 0 Stars
  • 507 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 1 Versions
  • 20 % Grown

The README.md

Oasis MSON Parser

API Blueprint Parser for PHP

Oasis MSON Parser is a PHP wrapper for the Drafter library., (*1)

API Blueprint is Web API documentation language. You can find API Blueprint documentation on the API Blueprint site., (*2)

Install

The best way to install this is via Composer., (*3)

$ composer require brianseitel/oasis-mson-parser

NOTE: Oasis MSON Parser depends on the Drafter library. Please see that repo for build instructions., (*4)

Getting started

Signature

function parse(string $data, $format = 'json')

Quickstart Example

<?php

require 'vendor/autoload.php';

$results = Oasis\Parser::parse('# My API', 'json');

Parsing Result

Parsing this blueprint:, (*5)

# GET /1
+ response

will produce the following object (result variable):, (*6)

{
  "element": "parseResult",
  "content": [
    {
      "element": "category",
      "meta": {
        "classes": [
          "api"
        ],
        "title": ""
      },
      "content": [
        {
          "element": "category",
          "meta": {
            "classes": [
              "resourceGroup"
            ],
            "title": ""
          },
          "content": [
            {
              "element": "resource",
              "meta": {
                "title": ""
              },
              "attributes": {
                "href": "/1"
              },
              "content": [
                {
                  "element": "transition",
                  "meta": {
                    "title": ""
                  },
                  "content": [
                    {
                      "element": "httpTransaction",
                      "content": [
                        {
                          "element": "httpRequest",
                          "attributes": {
                            "method": "GET"
                          },
                          "content": []
                        },
                        {
                          "element": "httpResponse",
                          "attributes": {
                            "statusCode": "200"
                          },
                          "content": []
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Contribute

Fork & Pull Request., (*7)

License

MIT License. See the LICENSE file., (*8)

The Versions

23/05 2016

dev-master

9999999-dev

An MSON parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.5.9