Download the PHP package oscarpalmer/quest without Composer
On this page you can find all versions of the php package oscarpalmer/quest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oscarpalmer/quest
More information about oscarpalmer/quest
Files in oscarpalmer/quest
Package quest
Short Description A PHP router.
License MIT
Homepage https://github.com/oscarpalmer/quest
Informations about the package quest
Quest
Quest is a router for PHP >=7
.
The name
In particular, questing heroes of all stripes seek after the fabled Daedric artifacts for their potent combat and magical benefits.
— Haderus of Gottlesfont, _Modern Heretics_
Getting started
Installation
Quest is available via Composer & Packagist.
Quest uses Shelf, a Rack-like interface for PHP made by me. It's pretty cool.
Basic usage
And that's it! But I'm sure you'll want to know more about API.
Routing
If you've ever used something like Sinatra, then routing with Quest shouldn't be too difficult.
There are three kinds of routing parameters that'll make working with complex routes a piece of cake.
*
: matches just about everything; i.e.*?
.:param
: matches any word character; i.e\w+
.(anything)
: optional match foranything
; i.e.(anything)?
.
Examples of routes
Callbacks
Echoes are captured and flushed. Please use return statements to output stuff.
Error handlers
Having an error handler ready for when you or the user hits a bump is always useful. Status-specific handlers takes precedence over the wildcard handler, which in turn take precedence over the default handlers.
Server stuff
Now, Quest can't do much if your server isn't set up properly, so here's two snippets for "proper" URL rewriting with Apache and nginx.
Apache
nginx
API
License
MIT Licensed; see the LICENSE file for more info.