https://github.com/bernardarhia/routee
A lightweight php routing library for writing fullstack applications, backend apis etc. It comes with speed and was inspired by how laravel handles it routing services in the framework
https://github.com/bernardarhia/routee
cms csrf-protection http lightweight php router routing url-handler
Last synced: 11 days ago
JSON representation
A lightweight php routing library for writing fullstack applications, backend apis etc. It comes with speed and was inspired by how laravel handles it routing services in the framework
- Host: GitHub
- URL: https://github.com/bernardarhia/routee
- Owner: bernardarhia
- Created: 2022-06-13T02:17:02.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-19T19:10:00.000Z (over 3 years ago)
- Last Synced: 2025-06-27T22:15:42.295Z (7 months ago)
- Topics: cms, csrf-protection, http, lightweight, php, router, routing, url-handler
- Language: PHP
- Homepage:
- Size: 85.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Routee
A lightweight php routing service for writing fullstack applications in PHP.
# Notice
Make sure you are using php version >= 8.0.1
# Installation
```sh
composer require bernard-arhia/routee
```
# Example
## A simple route service
index.php
```php
use Http\Router;
require_once __DIR__ . "/vendor/autoload.php";
$router = new Router;
$router->get("/", function(){
echo "Hello world";
});
$router->run();
```
Now open the terminal and start your php web server
```sh
php -S localhost:9000
```
This will start the php server on port 9000
In your browser open http://localhost:9000 to preview the example

The Route accepts the following http request methods
* GET ($router->get())
* POST ($router->post())
* PUT ($router->put())
* DELETE ($router->delete())
* PATCH ($router->patch())
The router accepts basically the following parameters
* ***(string)*** **$path**: the path of the route
* ***(method)*** **$callback**: the callback function to be executed when the route is matched (You can also pass in a class method)