Download the PHP package pixo/outpost without Composer
On this page you can find all versions of the php package pixo/outpost. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package outpost
Short Description A PHP Framework for Decoupled Websites
License NCSA
Homepage http://getoutpost.org/
Informations about the package outpost
Outpost is a lightweight web framework, designed for decoupled websites. PHP 5.5+ is required.
What Outpost Does
Routing. Outpost uses Phroute to route an incoming request to the correct responder.
Caching. Each Outpost site has a Stash instance for storing resources between requests.
Logging. Outpost uses Monolog to send status messages to lots of types of logs.
What Outpost Doesn't Do
Templates. Outpost provides no default templating engine.
HTTP. Outpost doesn't provide a client for fetching external resources.
Quickstart
Create a new directory for your Outpost installation. From inside this directory, use Composer to install Outpost:
You should now have composer.json
and composer.lock
files, and a vendor
directory containing Outpost and its dependencies.
Create a new directory called public
, and in that directory make a new file called index.php
with the following contents:
Start a local PHP development server and point it at the public
directory:
Once the server is running, you should be able to visit http://localhost:8080/ and see the following:
What Just Happened?
Outpost received a request for the home page, and it routed the request to a function that printed "Hello."
When you visited http://localhost:8080/, the server directed you to the index.php
script. It included the Composer autoloader, then made a new Request object, using information from the server environment.
The script next created an Outpost Responders.
Finally, the new Site's respond()
method was called. The router used the Request object to find the right Responder: a function that printed "Hello."
Sites
Site objects have two primary purposes:
- They route each incoming request to the appropriate Responder.
- They provide Resources needed to create responses.
Responders
Responders act as router callbacks, and are expected to output a response when invoked.
Responder routes can be created using the site's addRoute()
method:
Responders receive 3 parameters when invoked:
- The Site object responding to the request
- The Request object
- Any parameters extracted from the URL
Resources
An Outpost installation may define any number of Resource classes. Resources are retrieved using the Site's get()
method, and they receive the Site object when invoked. The simplest resource is just a callable:
The get()
method invokes the callable and returns the result, so the output would be:
Caching
Resources that implement CacheableInterface
can be stored in the site cache, and are only invoked when the cached resource is missing or stale. Cacheable resources have a unique key, and specify the number of seconds they may be cached before a refresh is required.
The first time this resource is requested, it is invoked, and the return value is stored in the site cache. For subsequent requests, the cached copy is returned, until the copy is older than the value of getCacheLifetime()
.
The Site::getCache()
method provides access to the underlying Stash cache object.
All versions of outpost with dependencies
monolog/monolog Version ^1.19
phroute/phroute Version 2.*
symfony/http-foundation Version ~2.0
tedivm/stash Version 0.12.*
phpdocumentor/reflection-docblock Version ^3.1
twig/twig Version ^1.26
guzzlehttp/guzzle Version ^6.2
wp-cli/php-cli-tools Version ^0.11.1