php routing
1.0.0
A basic PHP router I made for small personal projects. Everything should work with PHP version 8.
app/view/hello.view.php ) page.The routing is a duct-tape version of the Laravel routing system. All the routing functions are located in app/core/router.php file.
To display a basic view from the /view folder.
Router::get("<ROUTE LOCATION>", "<NAME OF VIEW>");
Route request to a controller in the /controller folder. Make use of the use keyword to load in the controller.
Router::get("<ROUTE LOCATION>", [ExampleController::class, "<FUNCTION NAME>"]);
Execute your own custom function on request.
Router::get("<ROUTE LOCATION>", function() {
// SOME CODE
});
Use ::get for GET requests and ::post for POST requests. The routes are located in app/routes/routes.php, this file also contains examples.
This project is open-sourced software licensed under the MIT license.