19/05
2017
Simple PHP router class.
HRouter is a simple, open source PHP router. It's super small (~150 LOC), fast, and has some great annotated source code. This class allows you to just throw it into your project and start using it immediately., (*1)
If you have Composer, just include Macaw as a project dependency in your composer.json
. If you don't just install it by downloading the .ZIP file and extracting it to your project directory., (*2)
require: { "hkuan/hrouter": "dev-master" }
First, use
the Macaw namespace:, (*3)
use /Hkuan/Hrouter\Router;
Hrouter is not an object, so you can just make direct operations to the class. Here's the Hello World:, (*4)