Download the PHP package unl/reg-exp-router without Composer

On this page you can find all versions of the php package unl/reg-exp-router. 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 reg-exp-router

h1. RegExpRouter

h2. Introduction

RegExpRouter is a php router system that routes clean URLs based on regular expressions and support PSR-0 complient projects.

Possible Options for a new Router: $options = array( 'baseURL'=>'yoururl', //required: the full url: http://www.yoururl.com/ 'srcDir'=>'yourSrcDir' //Only required if you want to scan your models. Must be a full system path to your source directory. );

h2. Methods of routing:

  1. Scanning

The router will scan though your models and load routes. You will need a file called Routes.php within each of your model's directories (ie: project/exampleModel/Routes.php). This Routes.php file must extend RegExpRouter\RoutesInterface and define all of the routes for that model.

For each Model that has a route, you will need to place a file named "Routes" within that class, which implements RegExpRouter\RoutesInterface and define the regex routes for the model.

Routes are defined as an array of routes. And example route would look like this: $routes = array(array('yourRegex' => 'referenceModel'), array('moreRegex' => 'anotherModel')); The reference model should be the name of a class within the current model without it's namespace. The namespace will be added to it automatically.

Here is some example code for scanning your models:

$options = array('baseURL'=>'yoururl', 'srcDir'=>'yourSrcDir'); $router = new RegExpRouter\Router($options); $router->route($_SERVER['REQUEST_URI'], $_GET);

  1. User Defined Mapping

You can compile the array of regex to model mapping yourself and call the RegExpRouter->setRoutes(array) method:

Here is some example code for using your own mapping:

Routes are the same as the scaning method, except you should always define the fulll namesapce to the class within the model that you are referencing.

$options = array('baseURL'=>'yoururl'); $router = new RegExpRouter\Router($options); $router->setRoutes(array('/^home$/i' => 'ExampleProject\ExampleModel\View')); $router->route($_SERVER['REQUEST_URI'], $_GET);

h2. Example

To view the very simple Example application in the Example folder to get a better feel of how it works.

To set up the example application you will have to do the following: 1) Copy the config.sample.php to a new file called config.inc.php in the same folder. 2) Change the Example\Controller::$url in config.inc.php to a url that works with your setup. 3) Copy the sample.htaccess file to a new file called .htaccess in the same folder. 4) In .htaccess change the RewriteBase path to work with your setup.


All versions of reg-exp-router with dependencies

PHP Build Version
Package Version
No informations.
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 unl/reg-exp-router contains the following files

Loading the files please wait ....