m165437 / laravel-blueprint-docs
API Blueprint Renderer for Laravel
Installs: 74 512
Dependents: 0
Suggesters: 0
Security: 0
Stars: 227
Watchers: 8
Forks: 29
Open Issues: 15
Requires
- php: >=5.6.4
- erusev/parsedown: ^1.7.0
- erusev/parsedown-extra: ^0.7.1
- hmaus/drafter-php: ^6.1.1
- hmaus/reynaldo: ^0.1.5
- laravel/framework: >=5.4|~7.0
- dev-master
- v1.0.0
- v0.10.0
- v0.9.1
- v0.9.0
- v0.8.0
- v0.7.1
- v0.7.0
- v0.6.1
- v0.6.0
- v0.5.0
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.2
- v0.1.1
- v0.1.0
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-dependabot/npm_and_yarn/qs-and-express-6.11.0
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/eventsource-1.1.1
- dev-dependabot/npm_and_yarn/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/follow-redirects-1.14.8
- dev-dependabot/npm_and_yarn/ajv-6.12.6
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/dns-packet-1.3.4
- dev-dependabot/npm_and_yarn/browserslist-4.16.6
This package is auto-updated.
Last update: 2024-10-30 01:31:47 UTC
README
API Blueprint Renderer for Laravel
This Laravel package Blueprint Docs renders your API Blueprint. 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
.
Example output: If used with API Blueprint boilerplate, this would be Blueprint Docs' output.
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.
Requirements
- Laravel 5.4 or greater
- Drafter (the official C++ API Blueprint parser) 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 composer package to "install drafter in your php project with ease". Head over there and install it now.
Installation
Install the package via composer:
composer require m165437/laravel-blueprint-docs
Next, register its service provider (Laravel >= 5.5 does this automatically via Package Discovery):
// config/app.php 'providers' => [ ... M165437\BlueprintDocs\BlueprintDocsServiceProvider::class, ];
Optionally, publish the example API Blueprint boilerplate file blueprint.apib
to the root directory of your Laravel project:
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="example"
Finally, publish its assets to public/vendor/blueprintdocs
:
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="public"
Find your documentation at route /api-documentation
.
Update
When you update this package, you might need to republish its assets (note the added parameter --force
):
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="public" --force
Configuration
To adjust Blueprint Docs' configuration, publish its config file to config/blueprintdocs.php
:
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="config"
The default contents of the configuration file look like this:
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', 'condense_navigation' => false, '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
:
php artisan vendor:publish --provider="M165437\BlueprintDocs\BlueprintDocsServiceProvider" --tag="views"
Contributing
Thank you for considering contributing to this package! Please see CONTRIBUTING for details.
Credits
This package relies heavily on work done by Hendrik Maus, namely his Drafter PHP Wrapper and Reynaldo, it's inspired by Aglio, an API Blueprint renderer written in Node.js, and provides the API Blueprint boilerplate as an example. The header is the modified part of a graphic created by Iconicbestiary, via Freepik.com.
License
Blueprint Docs is licensed under the MIT License (MIT). Please see the LICENSE file for more information.