Download the PHP package ween/conveyor without Composer
On this page you can find all versions of the php package ween/conveyor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ween/conveyor
More information about ween/conveyor
Files in ween/conveyor
Package conveyor
Short Description PHP router, support simple route group function.
License MIT
Homepage https://github.com/arnoluo/conveyor
Informations about the package conveyor
Conveyor
Intro
Conveyor is a PHP router, supports route group function.
Features:
Register available uri-prefix, class namespace and middleware initially;
Set different route prefix and namespace in each route group;
Set simple middlewares for every route.
Install
If you have Composer, just include as a project dependency in your composer.json. If you don't just install it by downloading the .ZIP file and extracting it to your project directory.
Or command line:
Usage
First, use
the Route namespace:
Second, write routes(writing style just like Laravel):
Basic:
Last, dispatch or just capture request:
single usage:
usage in container:
You can also use regex in Route, three can be recognized now:
Route group function:
If you do not need middleware function, the above codes are enough. If not, please read the Extension below.
Extension
There are some useful functions provided by Conveyor:
Registe some common properties:
register need be called before writing router.
Rewrite 404 notice when route dispatch failed:
Set some middlewares for a single route:
Example for middleware:
yourRoute.php:
HomeMiddleware.php
Conveyor will run middleware as HomeMiddleware->handle(); So every middleware need a
handle()
method.