2017 © Pedro Peláez
 

library router

simple router class for php

image

izniburak/router

simple router class for php

  • Sunday, March 25, 2018
  • by izniburak
  • Repository
  • 3 Watchers
  • 16 Stars
  • 260 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 7 Versions
  • 16 % Grown

The README.md

Router

  _____  _    _ _____             _____             _            
 |  __ \| |  | |  __ \           |  __ \           | |           
 | |__) | |__| | |__) |  ______  | |__) |___  _   _| |_ ___ _ __
 |  ___/|  __  |  ___/  |______| |  _  // _ \| | | | __/ _ \ '__|
 | |    | |  | | |               | | \ \ (_) | |_| | ||  __/ |   
 |_|    |_|  |_|_|               |_|  \_\___/ \__,_|\__\___|_|   

PHP Router, which also has rich features like Middlewares and Controllers is simple and useful router class for PHP., (*1)

Tests Total Downloads Latest Stable Version Latest Unstable Version License, (*2)

Features

  • Supports GET, POST, PUT, DELETE, OPTIONS, PATCH, HEAD, AJAX and ANY request methods
  • Easy access and manage Request and Response via symfony/http-foundation package.
  • Controllers support (Example: HomeController@about)
  • Before and after Route Middlewares support
  • Static Route Patterns
  • Dynamic Route Patterns
  • Easy-to-use patterns
  • Adding a new pattern supports. (with RegExp)
  • Namespaces supports.
  • Group Routing
  • Custom 404 and Exception handling
  • Debug mode (Error message open/close)

Install

To install PHP Router, You can run the following command directly at your project path in your console:, (*3)

$ composer require izniburak/router

OR you can add following lines into the composer.json file manually:, (*4)

{
    "require": {
        "izniburak/router": "^2.0"
    }
}

Then, run the following command:, (*5)

$ composer install

Example Usage

require 'vendor/autoload.php';

use Buki\Router\Router;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

$router = new Router;

// For basic GET URI
$router->get('/', function(Request $request, Response $response) {
    $response->setContent('Hello World');
    return $response;

    # OR
    # return 'Hello World!';
});

// For basic GET URI by using a Controller class.
$router->get('/test', 'TestController@main');

// For auto discovering all methods and URIs
$router->controller('/users', 'UserController');

$router->run();

Docs

Documentation page: Buki\Router Docs, (*6)

Changelogs: Buki\Router Changelogs, (*7)

Support

izniburak's homepage, (*8)

izniburak's twitter, (*9)

Licence

MIT Licence, (*10)

Contributing

  1. Fork it ( https://github.com/izniburak/php-router/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • izniburak İzni Burak Demirtaş - creator, maintainer

The Versions

25/03 2018

dev-master

9999999-dev https://github.com/izniburak/php-router

simple router class for php

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php route simple router

25/03 2018

v1.1.3

1.1.3.0 https://github.com/izniburak/php-router

simple router class for php

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php route simple router

20/01 2018

v1.1.2

1.1.2.0 https://github.com/izniburak/php-router

simple router class for php

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php route simple router

20/01 2018

v1.1.1

1.1.1.0 https://github.com/izniburak/php-router

simple router class for php

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php route simple router

02/06 2017

v1.1.0

1.1.0.0 https://github.com/izniburak/php-router

simple router class for php

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php route simple router

25/02 2017

v1.0.1

1.0.1.0 https://github.com/izniburak/php-router

simple router class for php

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php route simple router

22/02 2017

v1.0.0

1.0.0.0 https://github.com/izniburak/php-router

simple router class for php

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

php route simple router