Download the PHP package g-six/l5-api-documentor without Composer

On this page you can find all versions of the php package g-six/l5-api-documentor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package l5-api-documentor

Laravel API Documentation Generator

Automatically generate your API documentation from your existing Laravel routes. Take a look at the example documentation.

After a month of customising since forking from https://github.com/mpociot/laravel-apidoc-generator, there are a lot of changes made to fit our laravel base code ecosystem.

Please take note of the changes in options below as they are different from Mpociot's original code. Great work @mpociot.

php artisan api:gen --routePrefix="settings/api/*"

Installation

Require this package with composer using the following command:

Go to your config/app.php and add the service provider:

Using Laravel < 5.4? Use version 1.0! For Laravel 5.4 and up, use 2.0 instead.

Usage

To generate your API documentation, use the api:generate artisan command.

This command will scan your applications routes for the URIs matching api/v1/* and will parse these controller methods and form requests. For example:

Available command options:

Option Description
output  The output path used for the generated documentation. Default: public/docs
routePrefix The route prefix to use for generation - * can be used as a wildcard
routes The route names to use for generation - Required if no routePrefix is provided
middleware The middlewares to use for generation
noResponseCalls Disable API response calls
noPostmanCollection Disable Postman collection creation
useMiddlewares Use all configured route middlewares (Needed for Laravel 5.3 SubstituteBindings middleware)
auth A JSON object notation that contains credentials to different users with different roles required to access the API routes.
router The router to use, when processing the route files (can be Laravel or Dingo - defaults to Laravel)
bindings List of route bindings that should be replaced when trying to retrieve route results. Syntax format: binding_one,id|binding_two,id
force Force the re-generation of existing/modified API routes
header Custom HTTP headers to add to the example requests. Separate the header name and value with ":". For example: --header 'Authorization: CustomToken'

Publish rule descriptions for customisation or translation.

By default, this package returns the descriptions in english. You can publish the packages language files, to customise and translate the documentation output.

After the files are published you can customise or translate the descriptions in the language you want by renaming the en folder and editing the files in public/vendor/apidoc/resources/lang.

How does it work?

This package uses these resources to generate the API documentation:

Controller doc block

This package uses the HTTP controller doc blocks to create a table of contents and show descriptions for your API methods.

Using @resource in a doc block prior to each controller is useful as it creates a Group within the API documentation for all methods defined in that controller (rather than listing every method in a single list for all your controllers), but using @resource is not required. The short description after the @resource should be unique to allow anchor tags to navigate to this section. A longer description can be included below.

Above each method within the controller you wish to include in your API documentation you should have a doc block. This should include a unique short description as the first entry. An optional second entry can be added with further information. Both descriptions will appear in the API documentation in a different format as shown below.

Result:

Doc block result

Form request validation rules

To display a list of valid parameters, your API methods accepts, this package uses Laravels Form Requests Validation.

Result: Form Request

API responses

If your API route accepts a GET method, this package tries to call the API route with all middleware disabled to fetch an example API response.

With Mpciot's version, if your API needs an authenticated user, you can use the actAsUserId option to specify a user ID that will be used for making these API calls, this doesn't work with our base code, so we added the --auth option with parameters required by our auth.

If you don't want to automatically perform API response calls, use the noResponseCalls option.

Note: The example API responses work best with seeded data.

Postman collections

The generator automatically creates a Postman collection file, which you can import to use within your Postman App for even simpler API testing and usage.

If you don't want to create a Postman collection, use the --noPostmanCollection option, when generating the API documentation.

As of as of Laravel 5.3, the default base URL added to the Postman collection will be that found in your Laravel config/app.php file. This will likely be http://localhost. If you wish to change this setting you can directly update the url or link this config value to your environment file to make it more flexible (as shown below):

If you are referring to the environment setting as shown above, then you should ensure that you have updated your .env file to set the APP_URL value as appropriate. Otherwise the default value (http://yourappdefault.app) will be used in your Postman collection. Example environment value:

Skip single routes

If you want to skip a single route from a list of routes that match a given prefix, you can use the @hideFromAPIDocumentation tag on the Controller method you do not want to document.

License

The Laravel API Documentation Generator is free software licensed under the MIT license forked (https://github.com/mpociot/laravel-apidoc-generator) and customized to work with our team's base code.


All versions of l5-api-documentor with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
fzaninotto/faker Version ~1.0
laravel/framework Version ~5.4
mpociot/documentarian Version ^0.2.0
mpociot/reflection-docblock Version ^1.0
ramsey/uuid Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package g-six/l5-api-documentor contains the following files

Loading the files please wait ....