Download the PHP package alextech/expressive-route-openapi-doc without Composer

On this page you can find all versions of the php package alextech/expressive-route-openapi-doc. 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 expressive-route-openapi-doc

Expressive-Route-OpenAPI

Generate OpenAPI doc skeleton from expressive routes.

RouteOpenApiDoc uses application's router configuration to generate OpenAPI skeleton. The skeleton includes placeholders to write description for paths and their parameters, and references to schemas for REST style resources that are inferred from path segments. Besides being displayed in viewers like swagger-ui, these schemas can be used for validatingrequestBody in your middleware pipeline.

Other API documentation libraries focus on parsing annotations. While docblock annotations may be useful for MVC-style frameworks, where routing table and Controller/Actions are in separate locations making the connection between the two difficult to keep track of without extra hints, middleware-style frameworks, especially the PSR-15 compatible ones have the routing and handlers in one place, making extra docblocks for API documentation generators to parse redundant. Or, they try to generate code based on existing API specification, which behaves too CRUD-y, and may not be compatible with existing codebase.

Usage

In your router configuration function, get an instance of OpenApiWriter service. Add instance of Application or RouteCollector (if defining routes in multiple configurations using path segregated piplines, that has the routes needing to be documented, and call writeSpec.

This will produce a json file api_doc.json in the output directory configured as described next.

If you made changes to the generated file, as you most likely will since this is just a skeleton, and rerun the writer, changes will be merged.

By default, each guessed resource will be written to its own json schema file. If prefer to have all schemas as part of one single document, pass true as a parameter of writeSpec().

Since the generation of documents is a development task, and will slow down requests, it is recommended to have the above lines conditional only for development mode.

Base path

If you are adding multiple route containers using $apiWriter->addRouteCollector() or $apiWriter->addApplication(), chances are you are using path segregated pipelines technique to organize your routes. In this case, you will need to let the api writer know about the pipeline basepath because is not exposed by expressive to the route collection. Specify it as a second parameter of the add functions. Base path will also become a tag for all the routes starting from that path.

Configuration

Configuration is read from openapi_writer key of your application config. It is expected to have these options:


All versions of expressive-route-openapi-doc with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
zendframework/zend-expressive Version ^3.2
doctrine/inflector Version ^1.3
ext-json Version *
psr/container Version ^1.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 alextech/expressive-route-openapi-doc contains the following files

Loading the files please wait ....