问题描述
我正在寻找将一些动态的,REST式的路由添加到PHP应用程序中。我很乐意使用现有的路由库,因此我不必重新发明轮子。然而,当我看到Slim和F3之类的东西时,它们都带有我不想要的东西 - 比如模板和MVC - 都包含在内。因为我只是想要路由,所以最终会在我的应用程序中出现很多我不需要的框架代码。
有没有一个好的库,只有路由?解决方案
我正在寻找将一些动态的,REST式的路由添加到PHP应用程序中。我很乐意使用现有的路由库,因此我不必重新发明轮子。然而,当我看到Slim和F3之类的东西时,它们都带有我不想要的东西 - 比如模板和MVC - 都包含在内。因为我只是想要路由,所以最终会在我的应用程序中出现很多我不需要的框架代码。
有没有一个好的库,只有路由?解决方案
请试试 Klein :
/ p>
单一文件,独立且强大:
klein.php是一款适用于PHP 5.3+的闪电式快速路由器
I'm looking to add some dynamic, REST-esque routing to a PHP application. I'd love to use an existing routing library so I don't have to reinvent the wheel.
However, when I look at things like Slim and F3, they all come with things I don't want--like templating and MVC--included. Since I just want routing, I'd end up with a lot of framework code in my application that I don't need.
Is there a good library out there that only does routing? Or am I stuck with importing a full framework or reinventing the wheel?
Try Klein:
Single file, standalone and robust:
"klein.php is a lightning fast router for PHP 5.3+"
https://github.com/chriso/klein.php
这篇关于是否有独立的PHP路由库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!