Download the PHP package tobion/openapi-symfony-routing without Composer

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

OpenAPI-Symfony-Routing

Loads routes in Symfony based on OpenAPI/Swagger annotations.

CI

Installation

$ composer require tobion/openapi-symfony-routing

Version >= 1.2 requires zircote/swagger-php 3.x which is compatible with the OpenAPI Specification version 3. Version < 1.2 requires zircote/swagger-php 2.x which works with the OpenAPI Specification version 2 (fka Swagger). So tobion/openapi-symfony-routing can be used with both OpenAPI v2 and v3 and composer will select the compatible one for your dependencies. Route loading stays the same between those versions. You just need to update the annotations when migrating from OpenAPI v2 to v3.

Basic Usage

This library allows to (re-)use your OpenAPI documentation to configure the routing of your Symfony-based API. All the relevant routing information like the HTTP method, path and parameters are already part of the OpenAPI spec. This way you do not have to duplicate any routing information in Symfony. Consider having the controllers annotated with zircote/swagger-php like the following example:

This library provides an OpenApiRouteLoader that you need to define as service and configure where to look for annotations like so:

Then you need to tell Symfony to load routes using it:

Advanced Features

Scanning annotations in different directories

Naming routes

By default routes are auto-named based on the controller class and method. If you want to give routes an explicit name, you can do so using the OpenAPI operationId property:

Add format suffix automatically

If your API supports different formats it is often common to optionally allow specifying the requested format as a suffix to the endpoint instead of having to always change headers for content negotiation. The routing loader allows to add a .{_format} placeholder automatically to the routes. This is disabled by default and can be enabled using a format-suffix OpenAPI vendor extension:

The above example will create a route /foobar.{_format} where the format is optional and can be json or xml. You can also enable the format-suffix globally by configuring it on the root OpenApi annotation and disable it for certain routes again, see test fixtures.

Order routes with priority

Since Symfony 5.1, the order of routes defined using annotations can be influenced using a priority. This can be used to make sure templated routes do not match before concrete routes without parameters for the same URL. The priority can also be set on OpenAPI annotations using a priority vendor extension:

Contributing

To run tests:

$ composer install
$ vendor/bin/simple-phpunit

All versions of openapi-symfony-routing with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
symfony/finder Version ^4.4|^5.0
symfony/framework-bundle Version ^4.4|^5.0
symfony/routing Version ^4.4|^5.0
zircote/swagger-php Version ^3.0.3
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 tobion/openapi-symfony-routing contains the following files

Loading the files please wait ....