1. Go to this page and download the library: Download oscarpalmer/quest library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
oscarpalmer / quest example snippets
use oscarpalmer\Quest\Quest;
$quest = new Quest;
$quest->get("/", function () {
return "Hello, world!";
});
$quest->run();
# the following route will match /a/simple/path
$quest->get("/a/simple/path", $callback);
# the following route will match
# /path/to/dir/file.extension and /a/b/c/d/e/f/b/g/h.i
$quest->get("/*/:file.:ext", $callback);
# optional parameters should be wrapped in parentheses;
# the following route will therefore match both
# /path/to/dir/file.extension and /path/to/dir/file
$quest->get("/*/:file(.:ext)", $callback);
# Calling handlers
$quest->error(); # The error-handler defaults to 500.
$quest->error(401); # You can choose the error, too.
# Defining handlers
$quest->error(401, function () {}); # Status-specific errors are possible, too.
# Constructor
$quest = new Quest($a, $b, $c); # Optional parameters; array of routes, and Request
# and Response objects from Shelf; useful for testing
# Constants and properties
$quest::VERSION; # Current Quest version number
$quest->errors; # Array of error callbacks with status codes as keys
$quest->filters; # Array of filters with at most two children; "after" and "before"
$quest->parameters; # Object of route parameters
$quest->request; # Shelf Request object
$quest->cookies; # $_COOKIE object belonging to the Request object
$quest->data; # $_POST object
$quest->files; # $_FILES object
$quest->query; # $_GET object
$quest->server; # $_SERVER object
$quest->session; # $_SESSION object
$quest->response; # Shelf Response object
$quest->routes; # Array of routes
# Filter methods
$quest->after($path, $callback); # Add an after filter with a path to run after routing
$quest->before($path, $callback); # Add a before filter with a path to run before routing
# $path must be a string, and $callback must be a callable
# Route methods
$quest->delete($path, $callback); # Add a DELETE route;
$quest->get($path, $callback); # Add a GET (and HEAD) route
$quest->post($path, $callback); # Add a POST route
$quest->put($path, $callback); # Add a PUT route
# $path must be a string and $callback must be a callable
# Error method
$quest->error($status, $callback); # Add or run an error callback; will run an already defined
# or default callback if no $callback is supplied
# $status can be a valid status code or null (500 error);
# $callback must be a callable if supplied
# Helper methods
$quest->contentType($optional); # Get or set the content type of the response
$quest->header($name, $optional); # Get or set a response header
# Run method
$quest->run(); # Let the questing (routing) begin!
# Will run filters and the first matching route's callback
nginx
try_files $uri /index.php;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.