Download the PHP package sevencoder/router without Composer
On this page you can find all versions of the php package sevencoder/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package router
What's different about this Lib : This library has an implementation that allows you to configure a route without needing to specify a namespace. To do so, I implemented the SP Autoload feature that comes native in PHP. This way, you can define the Base Path for your controllers and proceed with route creation. The implementation of the custom autoload will take care of finding the controller class starting from the base path, considering the child folders.
Observation : These steps assume you are working on a Ubuntu system with Apache2. Adjustments might be needed for other operating systems or web servers.
Examples : In the library's installation folder, there are examples of .htaccess, controller, json of postman test examples, and an index file that will receive HTTP requests first and invoke the resources of the library
Note about last version(v0.0.3) : In this version, a method was implemented to address the security of requests by filtering parameters sent via POST using forms. Do not send parameters with the name or the following values, as they will be removed and sanitized to prevent attacks: from, select, insert, delete, where, drop table, show tables, #, --.
- To make it work on Apache, follow these steps:
1 - Install by running the following command in the command line:
Run the command:
composer require sevencoder/router
2 - To make it work on Apache2 on Ubuntu, for other operating systems, find equivalent commands.
Run the command:
sudo a2enmod rewrite
3 - To take effect, restart Apache2 with the command:
Run the command:
sudo systemctl restart apache2
4 - Configure a .htaccess file in a folder where it affects the relevant files. The content of the .htaccess file should be:
5 - Example of file that receive http request, configure router and call dispatch :