This repository has been archived on 2018-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
sleepy/index.php

54 lines
1.3 KiB
PHP
Raw Normal View History

2014-05-07 14:05:13 -04:00
<?php
/**
* Sleepy - a REST framework
*
*
* A PHP Rest Framework valuing convention over configuration,
* but aiming to be as flexible as possible
*
* @author Timothy J. Warren
* @package Sleepy
*/
2014-05-14 10:32:31 -04:00
namespace Sleepy\Core;
2014-05-07 14:05:13 -04:00
2014-05-14 10:32:31 -04:00
// Include namespaces
use Aura\Di\Container as DiContainer;
use Aura\Di\Factory as DiFactory;
use Aura\Router\RouterFactory;
2014-05-07 14:05:13 -04:00
2014-05-14 10:32:31 -04:00
define('BASEPATH', __DIR__ . '/');
define('SLEEPY_DIR', 'Sleepy');
define('APP_DIR', 'application');
2014-05-07 14:05:13 -04:00
define('APPPATH', __DIR__ . '/application/');
2014-05-14 10:32:31 -04:00
// Include 3rd party dependencies
include BASEPATH . '/vendor/autoload.php';
// Load the autoloader
require BASEPATH . SLEEPY_DIR . '/autoload.php';
$di = new DiContainer(new DiFactory());
2014-05-14 10:46:49 -04:00
$rf = new RouterFactory();
2014-05-14 10:32:31 -04:00
$di->set('config', new Config());
2014-05-14 10:46:49 -04:00
$di->set('router', $rf->newInstance());
2014-05-14 10:32:31 -04:00
$di->set('input', new Input());
$di->set('output', new Output($di->get('config'), $di->get('input')));
$browser->browser_name_regex = \utf8_encode($browser->browser_name_regex);
$di->get('output')->set_data(['json','yaml','html'], [
2014-05-07 14:05:13 -04:00
'$_SERVER' => $i->server(),
'$_GET' => $i->get(),
'$_POST' => $i->post(),
2014-05-14 10:32:31 -04:00
'$_PUT' => $i->put(),
'$_DELETE' => $i->delete(),
2014-05-07 14:05:13 -04:00
'$_ENV' => $i->env(),
'$_COOKIE' => $i->cookie(),
'browser' => $browser,
'raw headers' => $i->header(),
'parsed headers' => $i->header_array()
]);
// End of index.php