Download the PHP package wapmorgan/openapi-generator without Composer

On this page you can find all versions of the php package wapmorgan/openapi-generator. 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 openapi-generator

What is it?

It is OpenApi configuration generator that works with origin source code + phpdoc.

Latest Stable Version Latest Unstable Version License

Main purpose of this library is to automatize generation of OpenApi-specification for existing JSON-API with a lot of methods. Idea by @maxonrock.

  1. Open Api generator
    • Laravel Example
    • How it works
    • How to use
    • Integrations
  2. Extending
    • New scraper
    • Settings
    • Limitations
    • ToDo

OpenApiGenerator

What it does?

It generates OpenApi 3.0 specification files for your REST JSON-based API written in PHP from source code directly. You do not need to write OpenApi-specification manually.

Laravel Example

  1. Routes:

  2. One controller:

  3. One request and two responses:

  4. Result of generation from code: two endpoints with description and arguments for select.

How it works

  1. Scraper collects info about API (tags, security schemes and servers, all endpoints) and contains settings for Generator. Scraper is framework-dependent.
  2. Generator fulfills openapi-specification with endpoints information by analyzing source code:
    • summary and description of actions
    • parameters and result of actions Generator is common. It just receives information from Scraper and analyzes code by Scraper rules.

More detailed process description is in How it works document.

How to use

Invoke console script to generate openapi for your project (with help of integrations):

For example, for yii2-project:

  1. Run parser on project to analyze files and retrieve info about endpoints

  2. Generate specification(s) into yaml-files in api_docs folder by specification_name.yml

  3. Deploy swagger with specification (e.g. _apidocs/main.yml on port 8091)

More detailed description is in How to use document.

Integrations

There's few integrations: Yii2, Laravel, Slim. Details is in Integrations document. You can write your own integration for framework or your project.

Extending

New scraper

You use (or extend) a predefined scraper (see Integrations) or create your own scraper from scratch (extend DefaultScraper), which should return a result with list of your API endpoints. Also, your scraper should provide tags, security schemes and so on.

Scraper should return list of specifications (for example, list of api versions) with:

Detailed information about Scraper result: in another document.

Settings

DefaultGenerator provides list of settings to tune generator.

Parameter type default description
CHANGE_GET_TO_POST_FOR_COMPLEX_PARAMETERS bool false if callback has arguments with object , array , stdclass , mixed type or class-typed, method of argument will be changed to POST and these arguments will be placed as body data in json-format
TREAT_COMPLEX_ARGUMENTS_AS_BODY bool false move complex arguments to request body
PARSE_PARAMETERS_FROM_ENDPOINT bool false if callback id has macroses (users/{id}), these arguments will be parsed as normal callback arguments
PARSE_PARAMETERS_FORMAT_FORMAT_DESCRIPTION bool false if php-doc for callback argument in first word after argument variable has one of predefined sub-types (@param string $arg SUBTYPE Full parameter description), this will change sub-type in resulting specification. For example, for string format there are subtypes: date, date-time, password, byte, binary, for integer there are: float, double, int32, int64. Also, you can defined custom format with DefaultGenerator::setCustomFormat($format, $formatConfig)

Usage:

By default, they all are disabled.

Limitations

ToDo


All versions of openapi-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
zircote/swagger-php Version ^3.0
doctrine/annotations Version ^1.6
phpdocumentor/reflection-docblock Version ^4.3|^5.1
symfony/console Version ^5.0|^6.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 wapmorgan/openapi-generator contains the following files

Loading the files please wait ....