This package is abandoned and no longer maintained. The author suggests using the oladesoftware/httpcrafter package instead.

A lightweight router written in PHP

v1.1.4 2024-06-05 22:30 UTC

This package is auto-updated.

Last update: 2024-10-07 20:40:46 UTC


README

Latest Version License

A simple lightweight router implementation for handling HTTP routes written in PHP. This class allows you to define routes, group them, add middleware, and handle requests based on defined routes.

Table of Contents

Features

  • Singleton Pattern: Ensures a single instance of the router.
  • Route Definition: Add individual routes with HTTP methods, URI paths, and targets (controllers or closures).
  • Route Grouping: Group multiple routes under a common base path.
  • Middleware Support: Assign middleware to routes for pre-processing.
  • Named Routes: Name your routes for easier route generation.
  • Dynamic Route Matching: Match incoming requests to defined routes and extract parameters.
  • Route Execution: Execute the target action of matched routes.

Installation

  • Via Composer (Recommended):
composer require oladesoftware/router
  • Manual Installation:

Download the router class file and include it in your project.

Usage

For detailed usage instructions, please refer to the Usage Documentation.

License

This project is licensed under the MIT License. See the License file for details.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

Support

For support, please open an issue on the GitHub repository.

Contributors

Author