Download the PHP package benson/route-me without Composer
On this page you can find all versions of the php package benson/route-me. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download benson/route-me
More information about benson/route-me
Files in benson/route-me
Package route-me
Short Description A basic router for REST APIs with all compatible with all RESTFUL verbs
License MIT
Informations about the package route-me
benson/router-me
Description
Route-Me is a lightweight and flexible PHP router package for creating RESTful APIs. It supports route parameters, middleware, and PSR-7 request/response handling. Route-Me is built using the PSR-7 HTTP message interfaces and can be used with any PSR-7 implementation. It is also framework-agnostic and can be used with any PHP framework or standalone application. Route-Me is developed and maintained by Benson Osei-Mensah.
Installation
To install Route-Me, run the following command in your project directory:
Table of Contents
- Features
- Usage
- Contribution
- License
- Author
Features
- Route Definition: Add routes to the router using the
addRoute()
method. - Middleware: Apply middleware functions to specific routes or globally using the
withMiddleware()
method. - Request Handling: Handle incoming requests by matching URL and HTTP method against defined routes.
- Error Handling: Handle 404 Not Found scenarios and custom error handling logic.
- Route Parameters: Support for route parameters defined within the URL pattern.
- Flexible Callbacks: Use closures or class methods as callback functions.
- PSR-7 Support: Built-in support for JSON request/response handling.
Usage
To use Route-Me in your project, follow these steps:
-
Import the composer autoloader into your PHP file:
-
Create a new instance of the Router class:
-
Add routes to the router using the
addRoute()
method: - Handle incoming requests by calling the
run()
method:
Contribution
Contributions are welcome! To contribute to Route-Me, follow these steps:
- Fork the repository.
-
Create a new branch.
- Make your changes.
-
Commit your changes and push them to your branch. Make sure to add a clear commit message and include any relevant documentation updates. Since Route-Me follows the PSR-2 coding standards, please ensure that your code adheres to these standards. If you are not sure, you can use the PHP Coding Standards Fixer
- Submit a pull request. Please ensure that you adhere to the coding standards and write clear commit messages.
License
Route-Me is open-source software released under the MIT License. See LICENSE for details.
Author
Route-Me is developed and maintained by Benson Ose-Mensah.