Skip to content

Commit

Permalink
Initial commit v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
M165437 committed Sep 9, 2017
0 parents commit 9fb55e8
Show file tree
Hide file tree
Showing 47 changed files with 12,971 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/node_modules
/vendor
.DS_Store
.idea
composer.lock
21 changes: 21 additions & 0 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Hendrik Maus

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# API Blueprint Renderer for Laravel

This Laravel package *Blueprint Docs* renders your [API Blueprint](http://apiblueprint.org/). It comes with a standard theme that you can customize via Blade templates. Install the package and find your rendered documentation at route `/api-documentation`.

API Blueprint is a Markdown-based document format that lets you write API descriptions and documentation in a simple and straightforward way. Currently supported is [API Blueprint format 1A](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md).

## Requirements

* Laravel 5.4 or greater
* Drafter (the official C++ API Blueprint parser) [command line tool](https://github.com/apiaryio/drafter#drafter-command-line-tool)
* A valid API Blueprint `blueprint.apib` in the root directory of your Laravel project (example available)

**Drafter is not included** and must be installed beforehand. Use the [Drafter Installer](https://github.com/hendrikmaus/drafter-installer) composer package to "install drafter in your php project with ease". Head over there and install it now.

## Installation

Install the package via composer:

``` bash
composer require m165437/laravel-blueprint-docs
```

Next, register its service provider (Laravel >= 5.5 does this automatically via [Package Discovery](https://laravel.com/docs/5.5/packages#package-discovery)):

```php
// config/app.php
'providers' => [
...
M165437\BlueprintDoc\BlueprintDocServiceProvider::class,
];
```

Optionally, publish the example [API Blueprint boilerplate](https://github.com/jsynowiec/api-blueprint-boilerplate) file `blueprint.apib` to the root directory of your Laravel project:

```bash
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="example"
```

Finally, publish its assets to `public/vendor/blueprintdocs`:

```bash
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="public"
```

Find your documentation at route `/api-documentation`.

## Configuration

To adjust Blueprint Docs' configuration, publish its config file to `config/blueprintdocs.php`:

``` bash
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="config"
```

The default contents of the configuration file looks like this:

```php
return [

/*
|--------------------------------------------------------------------------
| Blueprint Docs
|--------------------------------------------------------------------------
|
| Find your rendered docs at the given route or set route to false if you
| want to use your own route and controller. Provide a fully qualified
| path to your API blueprint as well as to the required Drafter CLI.
|
*/

'route' => 'api-documentation',

'blueprint_file' => base_path('blueprint.apib'),

'drafter' => base_path('vendor/bin/drafter')

];
```

If you want to use Blueprint Docs with your own route and controller, set `'route' => false` and have a look at `vendor/m165437/laravel-blueprint-docs/src/BlueprintDocsController.php` to get an idea on how to set it up.

## Theming

To customize the default theme, publish its views to `views/vendor/blueprintdocs`:

``` bash
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="views"
```

## Credits

This package relies heavily on work done by [Hendrik Maus](https://github.com/hendrikmaus), namely his [Drafter PHP Wrapper](https://github.com/hendrikmaus/drafter-php) and [Reynaldo](https://github.com/hendrikmaus/reynaldo), it's inspired by [Aglio](https://github.com/danielgtaylor/aglio), an API Blueprint renderer written in Node.js, and provides the [API Blueprint boilerplate](https://github.com/jsynowiec/api-blueprint-boilerplate) as an example.

## License

Blueprint Docs is licensed under the MIT License (MIT). Please see the [LICENCE](LICENSE.md) file for more information.
41 changes: 41 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "m165437/laravel-blueprint-docs",
"description": "API Blueprint Renderer for Laravel",
"keywords": [
"api",
"blueprint",
"renderer",
"laravel",
"docs"
],
"license": "MIT",
"homepage": "https://github.com/M165437/laravel-blueprint-docs",
"authors": [
{
"name": "Michael Schmidt-Voigt",
"email": "[email protected]",
"homepage": "https://github.com/M165437",
"role": "Developer"
}
],
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.5.*",
"hmaus/drafter-php": "^4.0",
"hmaus/reynaldo": "^0.1.2",
"erusev/parsedown": "^1.6",
"erusev/parsedown-extra": "^0.7.1"
},
"autoload": {
"psr-4": {
"M165437\\BlueprintDocs\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"M165437\\BlueprintDocs\\BlueprintDocsServiceProvider"
]
}
}
}
22 changes: 22 additions & 0 deletions config/blueprintdocs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Blueprint Docs
|--------------------------------------------------------------------------
|
| Find your rendered docs at the given route or set route to false if you
| want to use your own route and controller. Provide a fully qualified
| path to your API blueprint as well as to the required Drafter CLI.
|
*/

'route' => 'api-documentation',

'blueprint_file' => base_path('blueprint.apib'),

'drafter' => base_path('vendor/bin/drafter')

];
Loading

0 comments on commit 9fb55e8

Please sign in to comment.