bodawahid/php-routing 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bodawahid/php-routing

Composer 安装命令:

composer require bodawahid/php-routing

包简介

this is a routing package made by boda wahid

README 文档

README

This package was developed during [PHP Course - beginned to advance]

It's a router for PHP to handle the requests.

Support us

to support me for the package or the course you can contact info@amirkamizi.com

Installation

You can install the package via composer:

composer require bodawahid/php-routing:dev-main@dev

Usage

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@bodawahid.com";
});

or

function contactMe(){
    echo "contact me at info@bodawahid.com";
}
Router::get("/contact","contactMe");

Testing

This was for learning purposes. Not tests has been written yet.

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Contribution guidelines will be written here or on a separate file like changelog. for now no contribution is accepted.

Security Vulnerabilities

Please contact me at bodawahid456@gmai;.com to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-11