luckystar/php-router
最新稳定版本:v1.4
Composer 安装命令:
composer require luckystar/php-router
包简介
A simple and fast PHP router
README 文档
README
simple and fast php page router.
#How Install
composer require luckystar/php-router
Plase add .htacces file:
Features
- GET/POST Methods
- Simple To Use
- Easily import php or html files
- You cant use parameters. :(
upcoming features
- Add Parameters.
- Add Middleware
Usage/Examples
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Set Theme folder
LuckyStar\PhpRouter\BHRouter::$themeFolder = "src/themes/";
Calling php when the index request comes
LuckyStar\PhpRouter\BHRouter::get("/", 'index.php');
Calling php when the about request comes
LuckyStar\PhpRouter\BHRouter::get("/about", 'about-page.php');
Calling function when the index request comes
LuckyStar\PhpRouter\BHRouter::post("/", function(){ echo "test"; });
pass variables
$pages = ['index','header','footer']; LuckyStar\PhpRouter\BHRouter::get("/", 'index.php', $pages);
Get URL Parameters
LuckyStar\PhpRouter\BHRouter::get('/bloglar/tes/{name}/{surname}', 'bloglar.php');
OR
LuckyStar\PhpRouter\BHRouter::get('/bloglar/tes/{name}/{surname}', function(){ echo $_GET['name']; echo $_GET['surname']; });
404 pages usage: (should be added to the end of the page. )
LuckyStar\PhpRouter\BHRouter::noOne("/404", function(){ echo "there is no such page"; });
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-04