fliglio / flfc
Installs: 28 472
Dependents: 7
Suggesters: 0
Security: 0
Stars: 1
Watchers: 8
Forks: 0
Open Issues: 2
Requires
- php: >=5.6
- fliglio/http: 2.3.*
Requires (Dev)
- phpunit/phpunit: 5.7.*
This package is auto-updated.
Last update: 2024-12-21 14:37:48 UTC
README
Fligilo.Flfc
Example
<?php
use Fliglio\Flfc as flfc;
use Fliglio\Flfc\DefaultFcChainResolver;
use Fliglio\Flfc\FcChainFactory;
use Fliglio\Flfc\FcChainRunner;
use Fliglio\Flfc\Context;
use Fliglio\Flfc\Request;
use Fliglio\Flfc\Response;
error_reporting(E_ALL | E_STRICT);
ini_set("display_errors" , 1);
require_once dirname(dirname(__FILE__)) . '/vendor/autoload.php';
// Configure Context
$context = Context::get();
$context->setRequest(new Request());
$context->setResponse(new Response());
$context->getRequest()->setCurrentUrl('/' . ltrim($_GET['fliglio_request'], '/'));
$context->getRequest()->setPageNotFoundUrl("@404");
$context->getRequest()->setErrorUrl("@error");
$context->getRequest()->setRawInputStream(file_get_contents('php://input'));
$context->getRequest()->setParams($_REQUEST);
// Configure Front Controller Chain & Default Resolver
$chain = new flfc\HttpApp(new flfc\ModuleApp());
$resolver = new DefaultFcChainResolver($chain);
FcChainFactory::addResolver($resolver);
// Run App
$chainRunner = new FcChainRunner();
$chainRunner->dispatchRequest(Context::get());