Download the PHP package delejt/y2apidoc without Composer
On this page you can find all versions of the php package delejt/y2apidoc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package y2apidoc
Yet Another ApiDoc Generator for Laravel
Automatically generate your API documentation from existing Laravel routing and Class/methods docblocks
Some screenshots
- y2apidoc
- y2apidoc - method
Prerequisites
- PHP 7
- Laravel 5.6
Installing
Publishing config and template files
Configuration
Before you can generate your documentation, you'll need to configure a few things in your config/y2apidoc.php:
-
configure your api routing prefix:
-
change your documentation output path
-
you can change template for documentation (default is bootstrap 3.3 simple template)
-
path for custom tags special templates, name of the file must be [tag_name]tag.blade.php, ex.: tabletag.blade.php
-
specify custom languages templates (PHP/Shell included):
-
specify available tags for parser (or add your own), You can place here custom renderer class
-
specify default headers added to all request:
-
specify bindings - variables will automatically replaced during documentation generation process:
-
specify bootstrap classes using for labelling method as PUT/POST/PATCH/DELETE/GET
- configure headers automatically added to each response:
Documentation
Y2apidoc uses HTTP controller doc blocks to create a table of contents and show descriptions for your API methods. Package automatically create groups from controller names. All routes handled by that controller will placed under this group in the sidebar menu
Tags
This package uses standard php DocBlock comments. Packages has custom Tags defined too.
-
@notice sample notice message presented as bootstrap alert, example:
-
@warning sample warning message presented as bootstrap alert
-
@table tag to create table in your documentation - example for special params list
-
@response tag to show example response from current method
- @responsefile tag to show response from current method - see Response File section
Custom Tags...
You can define custom tags by adding it's name to config file, example:
You can specify custom renderer for this tag by putting class path:
Next create class with 'parse' method in given path:
Your custom tag is now available in your docblock. If you want create Tag with custom template,
Next, put template in your tags_template_path:
with some html:
And that's all. Now You ready to generate Api Documentation :)
Custom programming languages tabs
To define custom languages tabs, just create blade template in path declared in config file:
Name of this file should be name of current language:
List of available variables in this template:
- url - parsed url with parameter ex.: https://domain.xxx/api/product_stocks/1/30
- endpoint - endpoint route, ex.: https://domain.xxx/api/product_stocks/{page}/{item_per_page}
- request_type - GET/POST/PUT etc.
- default_headers - array of default headers defined in config file
- body_params - array of body params
Response File
You can specify response file for current method by adding @responsefile to your docblock:
During documentation generation process package will try to find file product.stocks.index.json in storage/api directory Response file example:
Built With
- ReflectionDocBlock - The ReflectionDocBlock component of phpDocumentor
- highlight.php - server side code highlighter written in PHP
- Bootstrap 3.3 - Bootstrap is the most popular HTML, CSS, and JS framework
Authors
- Krzysztof Chełchowski - Initial work
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Todo
- tests
- better documentation
- more examples
- demo
All versions of y2apidoc with dependencies
illuminate/routing Version 5.5.* || 5.6.* || 5.7.*
illuminate/console Version 5.5.* || 5.6.* || 5.7.*
php Version >=7.1.0
phpdocumentor/reflection-docblock Version 4.*
scrivo/highlight.php Version ^9.13