PHPackages                             mpm/routing - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mpm/routing

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mpm/routing
===========

Mpm Router

v1.1.0(3y ago)1201MITPHPPHP ^8.0

Since Apr 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/rajmaholia/mpm-routing)[ Packagist](https://packagist.org/packages/mpm/routing)[ RSS](/packages/mpm-routing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (1)

mpm-rounting
============

[](#mpm-rounting)

Simple and Powerful PHP Routing for Your Web Applications

Table of Contents
-----------------

[](#table-of-contents)

- Introduction
- Features
- Getting Started
    - Prerequisites
    - Installation
- Usage
- Examples
- Contributing
- License

Introduction
------------

[](#introduction)

`mpm-routing` is your go-to solution for routing in PHP web applications. It simplifies the process of defining routes, matching requests, and handling routing errors.

Features
--------

[](#features)

- **Simplified Routing:** Define routes effortlessly using HTTP methods like GET and POST, making route setup a breeze.
- **Flexible Route Matching:** Match routes based on request URIs and HTTP methods, allowing for dynamic and precise routing.
- **Custom Exception Handling:** Handle routing errors with ease using custom exception handling. Detect and respond to issues gracefully.
- **Modular and Lightweight:** `mpm-routing` is designed to be lightweight and easy to integrate into your PHP project, ensuring minimal overhead.
- **Additional Routes:** Organize your routes by including additional route files, making your codebase clean and maintainable.
- **Listing Routes:** Retrieve a list of all registered routes programmatically, helping you understand your application's routing structure.
- **Community Support:** Join a thriving community of developers using `mpm-routing` and benefit from ongoing updates and improvements.
- **Open Source:** This project is open source and available under the MIT License, so you can use it in your projects with confidence.
- **Responsive Development:** Enjoy responsive development with regular updates and contributions from the community, ensuring your routing needs are met.
- **Easy Integration:** Seamlessly integrate `mpm-routing` into your existing PHP projects or use it in new ones without complex setup.

Choose `mpm-routing` for a powerful yet easy-to-use routing solution in your PHP web applications.

Getting Started
---------------

[](#getting-started)

### Prerequisites

[](#prerequisites)

- php &gt;= 8.0
- mpm\\http &gt;= 1.1

### Installation

[](#installation)

- `composer require mpm\routing`

Usage
-----

[](#usage)

#### 1. Define basic routes using HTTP methods like GET and POST.

[](#1-define-basic-routes-using-http-methods-like-get-and-post)

```
  Specify the route URI and the associated controller or handler function.
  ```
    // Define a GET route
    Route::get('/home', 'HomeController@index');

    // Define a POST route
    Route::post('/submit', 'FormController@process');
  ```

```

#### 2. Handling Dynamic Routes

[](#2-handling-dynamic-routes)

```
    Match dynamic routes using route parameters enclosed in curly braces `{}`. These parameters capture values from the URL for further processing.

    ```
