Download the PHP package onmoon/openapi-server-bundle without Composer

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

Symfony OpenApi Server Bundle

Mutation testing badge Test Coverage Type Coverage Latest Stable Version License

About

This bundle can generate most of the usual boilerplate code you write when implementing an API. The code is generated from OpenAPI specifications.

The following concerns are handled by the bundle automatically:

All you have to do is to implement the API call handler interfaces and return the provided response object.

Installation

The preferred way to install this extension is through composer.

Run

Then add the bundle class to your config/bundles.php:

Usage

You can configure the bundle by adding the following parameters to your /config/packages/open_api_server.yaml

Add your OpenApi specifications to the application routes configuration file using standard resource keyword with open_api type:

Requirements for your OpenAPI schemas

For the bundle to work properly with your specifications, they should be written in OpenAPI 3.0 format and each operation must have an unique operationId.

Currently, there are also the following limitations:

Generating the API Server code

There are two console commands that work with the generated API server code:

Most of the time you should use the generate command. It will clear the bundle cache, delete the old generated server code if it exists and generate the new code.

Be careful with the generate and delete commands, they will delete the entire contents of the directory you have specified in root_path in the /config/packages/open_api_server.yaml file. That directory should contain no files except the code generated by this bundle, as it will be deleted every time you generate the API server code.

For each operation described in the specification, a API call handler interface will be generated that you should implement to handle the API calls.

Implementing the API call handlers interfaces

Given the following generated API handler interface:

Your API call handler could look like this:

Additionally, your API call handler can implement the following interfaces:

Using DTO mapper

If you want to use Doctrine entities or other business logic classes as sources for API response, you can easily copy contents into DTO using DTO mapper.

Install it with

And use like follows

More information

Customizing the API server behavior

During the request handling lyfecycle the API server emits several events that can be used instead of the built-in Symfony Kernel events as the former provide more context. Theese events allow hooking into the API server functionality and modify it's behavior.

The following events are available:

Customizing API server code generation

During API server code generation the code generator emits several events that can be used to modify the generated code either by changing parts of the OpenAPI specification objects or by changing the objects representing the various code definitions like classes, properties, methods.

The following events are available:


All versions of openapi-server-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
cebe/php-openapi Version 1.6.99
league/openapi-psr7-validator Version ^0.22.0
lukasoppermann/http-status Version ^4.0
nikic/php-parser Version ^4.19
nyholm/psr7 Version ^1.5
phpdocumentor/reflection-docblock Version ^5.3
sspat/reserved-words Version ^3.0
symfony/cache Version ^6.4|^7.0
symfony/cache-contracts Version ^3.5
symfony/config Version ^6.4|^7.0
symfony/console Version ^6.4|^7.0
symfony/dependency-injection Version ^6.4|^7.0
symfony/event-dispatcher Version ^6.4|^7.0
symfony/http-kernel Version ^6.4|^7.0
symfony/psr-http-message-bridge Version ^6.4|^7.0
symfony/routing Version ^6.4|^7.0
symfony/yaml Version ^6.4|^7.0
thecodingmachine/safe Version ^1.3|^2
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 onmoon/openapi-server-bundle contains the following files

Loading the files please wait ....