Download the PHP package jetfirephp/routing without Composer

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

JetFire PHP Routing

SensioLabsInsight Build Status Scrutinizer Code Quality

A simple & powerful router for PHP 5.4+

Features

V1.3

V1.2

V1.1

V1.0

Getting started

  1. PHP 5.4+ is required
  2. Install JetFire\Routing using Composer
  3. Setup URL rewriting so that all requests are handled by index.php

Installation

Via composer

.htaccess

Usage

Create an instance of JetFire\Routing\RouteCollection and define your routes. Then create an instance of JetFire\Routing\Router and run your routes.

Matcher

JetFire\Routing provide 2 type of matcher for your routes : JetFire\Routing\Matcher\ArrayMatcher and JetFire\Routing\Matcher\UriMatcher

Uri Matcher

With Uri Matcher you don't have to define your routes. Depending on the uri it can check if a target exist for the current url. But you have to define your views directory path and controllers namespace to the collection :

For example if the uri is : /home/index

Resolver

Here are the list of Uri Matcher resolver :

Template resolver

Uri Matcher check if an index.php file exist in /_VIEW_DIR_PATH_/Home directory.

If you want to check for other extension (html,json,...) You can configure the router like this :

Controller resolver

With Controller resolver, Uri Matcher checks if a controller with name HomeController located in the namespace _CONTROLLERS_NAMESPACE_ has the index method. You have to require your controller before matching or you can use your custom autoloader to load your controllers. Uri Matcher support also dynamic routes. For example if the uri is : /home/user/peter/parker then you must have a method user with two parameters like this :

Array Matcher

With Array Matcher you have to add your routes like this :

We recommend that you define your routes in a separate file and pass the path to addRoutes() method.

Resolver

Here are the list of Uri Matcher resolver :

You have 5 actions possible for Array Routing. We assume you are using a separate file for your routes.

Template resolver

Controller resolver

Controller and Template resolver

Controller group resolver

Closure resolver

Closure and Template resolver

Block Routes

With JetFire\Routing you have the ability to create block routes to better organize your code. For example , if you have an administration for your website , you can create block only for this section and another block to the public part like this :

Router Configuration

Here are the list of router configuration that you can edit :

Collection Options

Here are the list of options that you can edit for each collection routes :

Named Routes

You can specify a name for each route like this :

And then to get the url of this route you can do like this :

Supported only in JetFire\Routing\Matcher\ArrayMatcher.

REST Routing

You can specify the request method for each route like this :

Prefix

You can set a prefix for each routes collection like this :

Or :

Middleware

Middlewares are called before and after a route match the current uri. You have to create a middleware config file like this :

Then you have to instantiate the middleware class Middleware like this :

Let see how to create your Middleware Class. For example we take the Global middleware :

See the API section to learn how to handle your $route in middleware class.

Custom Matcher and Dispatcher

If the default matcher and dispatcher doesn't match your expectation, you can write your own matcher and dispatcher like this :

You can also override the default matcher like this :

Integration with other libraries

If you want to integrate other template engine libraries like twig, smarty ... you have to set the 'templateCallback' in router.

Subdomain

Or if you want to add a subdomain for a bloc, you have to add this line in your route collection options :

API

Below is a list of the public methods and variables in the common classes you will most likely use.

License

The JetFire Routing is released under the MIT public license : http://www.opensource.org/licenses/MIT.


All versions of routing with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 jetfirephp/routing contains the following files

Loading the files please wait ....