-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9fb55e8
Showing
47 changed files
with
12,971 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/node_modules | ||
/vendor | ||
.DS_Store | ||
.idea | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
|
||
]; |
Oops, something went wrong.