Download the PHP package lancerhe/php-router without Composer

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

Routa

A RESTful, flexible MVC router component for PHP 5.4+. Declare rules which route HTTP requests to a controller.

Do we need another router?

There's loads of router components so why do we need another? Many of the existing ones are tightly coupled, poorly written. Routa is built with the following in mind:

Installation

Routa adheres to the PSR-0 spec. If you have a compatible autoloader place the contents of lib in your vendor directory.

Basic usage

Within your code create a new instance of the router class.

$router = new LancerHe\Router\Router;

This approach automatically uses the current page URL and HTTP method from the $_SERVER super global, it's possible to override this which we'll cover later.

Next add some routes to map URLs to controller names/actions:

$router
    ->add('GET', '/login', 'v1#Account#login')
    ->add('GET', '/profile/:id', 'v1#User#view')
    ->add('GET', '/profile/:id/edit', 'v1#User#edit')
    ->add('GET', '/search/*', 'v1#Products#search');

Once all your routes have been declared match your request against them.

if($result = $router->match()) {
    // Assuming the url is /profile/432
    var_dump($result->getModuleName()); // returns 'v1'
    var_dump($result->getControllerName()); // returns 'User'
    var_dump($result->getActionName()); // returns 'view'
    var_dump($result->getParams); // returns ['id' => 432]
    // Load your controller… 
} else {
    // Display your 404 page.
}

All versions of php-router with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 lancerhe/php-router contains the following files

Loading the files please wait ....