Download the PHP package samir-plusb/silex-routing-service-provider without Composer

On this page you can find all versions of the php package samir-plusb/silex-routing-service-provider. 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 silex-routing-service-provider

RoutingServiceProvider

Latest Version Build Status Coverage Status Quality Score Total Downloads

RoutingServiceProvider is a silex provider for easily adding routes

Features

Installing

Via Composer

Options

Each route is required to have the following parameters:

Optionally, you can set a route name (for named routes). The key of the $route-array will be used as the route name or you can set it like this:

Optionally the following parameters can also be added:

value (array)

You can add default values for any route variable: http://silex.sensiolabs.org/doc/usage.html#default-values

assert (array)

You can add requirements: http://silex.sensiolabs.org/doc/usage.html#requirements

convert (array)

You can add route variable converters: http://silex.sensiolabs.org/doc/usage.html#route-variable-converters. Before you can use the route variable converter, you need to add it as a service.

before (array)

Add a before-middleware: http://silex.sensiolabs.org/doc/middlewares.html#before-middleware

after (array)

Add an after-middleware: http://silex.sensiolabs.org/doc/middlewares.html#after-middleware

Usage

Adding a single route

index.php

Adding multiple routes

index.php

Adding before/after middleware

To add controller middleware you can use the 'after' and 'before' key of the route configuration. The 'before' key is used to run the middleware code before the controller logic is executed, after execution of the controller logic. Below is an example using a middleware class and how to configure this in the route config. Instead of using a middleware class you can also use a regular callback.

Note Be aware that currently there is only support for php.

Example middleware class:

Using the middleware class in the route configuration

index.php

Adding a route middleware class via yml

You can add middleware classes via yml-/xml-configuration. Example:

routes.yaml

The methods' interface need to match the Silex specification. Further information about route middleware classses: http://silex.sensiolabs.org/doc/middlewares.html#route-middlewares.

ATTENTION: Unfortunately with this way, you cannot use the ´__invoke´ method described above.

Registering providers with configuration

For this example the ConfigServiceProvider is used to read the yml file. The RoutingServiceProvider picks the stored configuration through the node config.routing as in $app['config.routing'] by default. If you want to set a different key, add it as parameter when instantiating the RoutingServiceProvider ***Note: The key of the array will also be used as the ´route´, so you can omit ´route.

routes.yaml

routes.php

index.php

Note: It's recommended to use php instead of yml/xml/etc, because it can be opcached. Otherwise you have to implement a caching mechanism yourself.

Todo


All versions of silex-routing-service-provider with dependencies

PHP Build Version
Package Version
Requires silex/silex Version 1.*
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 samir-plusb/silex-routing-service-provider contains the following files

Loading the files please wait ....