bookfrank/viaduct

Viaduct is a very simple php router, hope to be able to help the php-framework beginners to understand the principle of router better

v2.0.0 2017-02-16 14:24 UTC

This package is not auto-updated.

Last update: 2025-06-08 05:49:09 UTC


README

Viaduct is a simple but quick PHP router.

Viaduct is a very simple php router, hope to be able to help the php-framework beginners to understand the principle of router better.

Features

  • Simple
  • One-file (only 6 functions)
  • Laravel-like routes

Installation

  1. You can directly run composer require to install in your project.
composer require bookfrank/viaduct
  1. Also you can get the viaduct simply require it in your composer.json file.
"bookfrank/viaduct": "dev-master"

You will then need to run composer install to download it and have the autoloader updated.

Usage

First, create the routes.php file.

<?php
use \Bookfrank\Viaduct\Router;

Router::get('hello', function(){
	echo "Hello viaduct";
});

Router::get('profile/{uid}', function($uid){
	echo "Present userid is ".$uid;
});

Router::get('blog/{id}', "\Foo\Bar\FooController@bar");

Router::dispatch();
<?php
class FooController{
	public function bar($id){
    	echo "id is ".$id;
    }
}

Contact me

Author: Frank 李扬

Email: bookfrank@foxmail.com