Skip to content

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

Notifications You must be signed in to change notification settings

bernardarhia/routee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Routee

A lightweight php routing service for writing fullstack applications in PHP.

Notice

Make sure you are using php version >= 8.0.1

Installation

composer require bernard-arhia/routee

Example

A simple route service

index.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

php -S localhost:9000

This will start the php server on port 9000 In your browser open http://localhost:9000 to preview the example A screenshot

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)

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages