Download the PHP package alejoluc/via without Composer

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

alejoluc\Via

Simple PHP router with prefix grouping and filters

Work in Progress

This README file is a work in progress and is in the process of being written. In the meantime, please refer to the examples folder to get started.

Usage

Please refer to the examples folder to see how to use the router, along with usage of grouping and filters.

Installation

From the command line:

composer require alejoluc/via

Or write manually in composer.json:

Using the "Facade"

A "Facade" is provided for those that want clearer code and don't mind using static classes here and there. You can use any method of the Router class when calling the Facade.

Match Handlers

There are three possible scenarios when calling the dispatch() method: no route will match, or a route will match but some or all filters will fail, or a route will match and no filter fails.

In all cases, a Match object is passed to whatever match handler or handlers you have set up. You can see the src/SampleHandlers/ folder for several comprehensive handlers.

Letting the router build the request string on it's own or using setRequestString()

If no request string is manually specified, the router will try to get it automatically from $_SERVER['REQUEST_URI'] or $_SERVER['PATH_INFO']. Aditionally, it will truncate the script file name from the request string, if it is there, and it will also truncate the query string (anything after ? or &), if it exists. This will not happen if you manually set the request string via Router::setRequestString()

As a general rule, you should manually call Router::setRequestString() only when you know what you are doing and why, and let the router do the dirty work the rest of the time.

For example, if you have no url rewriting in place in your server, you might still want to use the router and you can do it by placing the routes in a query variable, like q. An example for that approach, assuming the file name is index.php, would be:


All versions of via with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.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 alejoluc/via contains the following files

Loading the files please wait ....