Download the PHP package iassasin/easyroute without Composer

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

Easyroute

PHP Version Build Status Coverage Status

Simple router do not require a lot of setups, install in few minutes and just works.

Installation

To start using router complete 4 simple steps:

  1. Install easyroute via composer:

  2. Setup yours routes in root directory of project. For example in file routes.php:

  3. Tell web server redirect all requests (except static assets/) to router via .htaccess:

  4. Create first controller in controllers/home.php:

That's it!

Note that file name must match :controller name from URL template and controller class name must match :controller name with prefix Controller. In example above route /home/index matches file controllers/home.php and class ControllerHome.

Useful features

Route with parameters

Route is a regex string with simpler syntax for naming route arguments. For example:

Parameter name must match regex [a-zA-Z_0-9]+.
By default :parameter match regex [^\/]+, but you can use your own filter:

If you need to use ( to match group, but not to filter parameter, use trailing : in parameter name: /:controller:(postfix1|postfix2) will match /homepostfix1 with controller = 'home'.

Built-in simple dependency injection container

You can use built-in dependency injection container to split app code into services (which will be loaded via autoload) and simply use it in controller's actions:

Services constructors can use dependency injection too and require another services via same syntax.

Class SampleContainer impletents Psr\Container\ContainerInterface.

Also you can use another dependency injection container:

Request class

Using dependency injection container you have access to Request service that provides access to request parameters.

Request has fields listed below:

Each field is instance of Parameters class and has methods:

Request provide some useful methods:

Response class

Response class used to return data to client. Return Response instances from controller's actions instead of manual data send using echo or etc.

Built-in response classes

There is 3 built-in response classes:

Custom handlers for response classes

Set custom handlers for Response classes:

And custom handlers for any http status code:

Note 1: you can use both handlers set, but response handlers will be called first (and can stop calling status handlers).

Note 2: you can set handler for parent response class to match all childs, child handlers will be always called first: from most child to first parent. So, you can match all responses setting handler for Response::class.

Subdirectories for controllers

Separate zones with subdirectories:

Filtering access

Use RouteFilter to prevent access to some routes:

Custom controller class name prefix

Set custom controller class name prefix (default - Controller):


All versions of easyroute with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
psr/container Version ^1.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 iassasin/easyroute contains the following files

Loading the files please wait ....