Ejemplo n.º 1
0
/**
 * Application document root
 */
define('DOCROOT', __DIR__ . DIRECTORY_SEPARATOR);
/**
 * Path to the vendor directory
 */
define('VENDORPATH', realpath(__DIR__ . '/../vendor/') . DIRECTORY_SEPARATOR);
/**
 * Fire up the Composer autoloader
 */
require VENDORPATH . 'autoload.php';
/**
 * Forge the FuelPHP Demo application, and fetch it's main component
 */
$component = Fuel::forge('Demo Application', 'Demo', isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : 'development');
/**
 * Using the main application component, we add a few test components manually
 * which are included in the demo applications components directory. Since the
 * are not composer installed, we need to specify the path to them. For composer
 * installed components, the namespace is enough to identify the component.
 */
$component->newComponent('moda', 'Moda', true, $component->getPath() . DS . 'components' . DS . 'moda' . DS . 'classes');
$component->newComponent('modb', 'Modb', false, $component->getPath() . DS . 'components' . DS . 'modb' . DS . 'classes');
/**
 * Get the demo application, fire the main request on it, and get the response
 */
try {
    $response = $component->getRequest()->execute()->getResponse();
} catch (\Fuel\Foundation\Exception\BadRequest $e) {
    // check if a 400 route is defined
Ejemplo n.º 2
0
/**
 * Application document root
 */
define('DOCROOT', __DIR__ . DIRECTORY_SEPARATOR);
/**
 * Path to the vendor directory
 */
define('VENDORPATH', realpath(__DIR__ . '/../vendor/') . DIRECTORY_SEPARATOR);
/**
 * Fire up the Composer autoloader
 */
require VENDORPATH . 'autoload.php';
/**
 * Forge the FuelPHP Demo application, and fetch it's main component
 */
$component = Fuel::forge('Demo Application', 'Demo', isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : 'production');
/**
 * Using the main application component, we add a few test components manually
 * which are included in the demo applications components directory. Since the
 * are not composer installed, we need to specify the path to them. For composer
 * installed components, the namespace is enough to identify the component.
 */
$component->newComponent('moda', 'Moda', true, $component->getPath() . DS . 'components' . DS . 'moda' . DS . 'classes');
$component->newComponent('modb', 'Modb', false, $component->getPath() . DS . 'components' . DS . 'modb' . DS . 'classes');
/**
 * Get the demo application, fire the main request on it, and get the response
 */
try {
    $response = $component->getRequest()->execute()->getResponse();
} catch (\Fuel\Foundation\Exception\BadRequest $e) {
    // check if a 400 route is defined