PHPackages                             greenswitch/ease-routes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. greenswitch/ease-routes

ActiveLibrary[Framework](/categories/framework)

greenswitch/ease-routes
=======================

An easy to use routing library for php

11PHP

Since Mar 11Pushed 4y agoCompare

[ Source](https://github.com/Green-Switch-Digital/easeroutes-php)[ Packagist](https://packagist.org/packages/greenswitch/ease-routes)[ RSS](/packages/greenswitch-ease-routes/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (1)Used By (0)

easeroutes-php
==============

[](#easeroutes-php)

Simplified PHP - Routing Library

\#installation

1. clone the repository (Download it) to your php project folder
2. Place the htaccess on your root directory for your php project
3. You're done and ready for implementation

\#Implementation

1. The .htaccess automatically points your project to index.php where all your routing logic will be place
2. require the Routes.php file located in easeroutes/src/Routes.php
3. If you are using composer, make sure to add the project in your composer.json file as shown below { "autoload": { "psr-4": { "EaseRoutes\\": "location-to-this-folder/easeroutes/src" } } }
4. run dump-autoload
5. You are ready to Code

\#COMPOSER "greenswitch/ease-routes": "dev-main"

\#Code "In the index.php"
-------------------------

[](#codein-the-indexphp)

\---------------WHEN USING COMPOSER ---------------- require "vendor/autoload.php";

```
use EaseRoutes\Routes;

$router         = new Routes();

$router->levels = 2;//start trimming url from level 2
$router->rootDir="";/*when deploying to production server, make sure to comment this section above*/

$router->get("","views/homepage.php");
$router->get("/admin","views/homepage.php");
$router->get("/products","views/products.php");
$router->get("/products/:productID/delete","views/product.php");

//dont forget to include this page incase the above routes did not work
$router->load404("views/404.php");

-------------------------------------------------------------
----------------------- PURE PHP-----------------------------
require "easeroutes/src/Routes.php";
$router         = new Routes();

$router->levels = 2;//start trimming url from level 2
$router->rootDir="";/*when deploying to production server, make sure to comment this section above*/

$router->get("","views/homepage.php");
$router->get("/admin","views/homepage.php");
$router->get("/products","views/products.php");
$router->get("/products/:productID/delete","views/product.php");

//dont forget to include this page incase the above routes did not work
$router->load404("views/404.php");

#METHODS DEFINITION
Routes::get(route, pagetoload) => bool
- a route definition with get properties.
a. route : a given url can be /products, /login, /admin. Always make sure this url begins with a forward slash
b. pagetoload : a physical file to be loaded relative to the root directory

Routes::post(route,pagetoload) => bool
- same as get but with post

Routes::load404("path/to/404page")
- if either of the given routes are not suplied in the url, then this page will help you relocate the user to this
default not found route. can be an html or php. To access the right error, use $errorCode and $message to display
the message on the UI

Routes::levels (default = 0)
- number of directories to skip to reach the real root directory. For example, you might have your project
  located 3 or 5 levels from the root directory in your development folder eg. localhost/projects/socialmedia/
  this example has 2 levels to the root directory, projects and socialmedia, so for this library to work properly
  in such scenarios, declare the levels property to the number of levels to skip in your directory

Routes::rootDir  (default = "")
- Given the example in levels, you also need to tell the library where your project is located if you have a multi
  level project. eg the above will be Routes::rootDir = "projects/socialmedia/". This will help in identifying
  proper directories to render your php files.

```

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3bb33f78164ef5cf817055d123edc9900b5f2b03b39e04f6c6a6df04a7be571f?d=identicon)[wonganikalouer](/maintainers/wonganikalouer)

### Embed Badge

![Health badge](/badges/greenswitch-ease-routes/health.svg)

```
[![Health](https://phpackages.com/badges/greenswitch-ease-routes/health.svg)](https://phpackages.com/packages/greenswitch-ease-routes)
```

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M299](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
