This package was developed during PHP Course - beginned to advance
It's a router for PHP to handle the requests.
to support me for the package or the course you can contact info@amirkamizi.com
You can install the package via composer:
composer require amirkamizi/router
you need to have a .htaccess file to redired everything to index or any other file.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [QSA,L]
then inside that file you can use the router to handle the reuqies.
passing name of that file that is going to handle the request.
Router::handle("GET","/contact","contact.php");
or
Router::get("/contact","contact.php");
Or you can pass anonymous and predefined functions to handle the request
Router::handle("GET","/contact",function(){
echo "contact me at info@amirkamizi.com";
});
or
function contactMe(){
echo "contact me at info@amirkamizi.com";
}
Router::get("/contact","contactMe");
This was for learning purposes. Not tests has been written yet.
composer test
Please see CHANGELOG for more information on what has changed recently.
Contribution guidelines will be written here or on a separate file like changelog. for now no contribution is accepted.
Please contact me at info@amirkamizi.com to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.