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

55 lines
1.2 KiB
PHP
Executable File

<?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
*/
namespace Sleepy;
define('BASEPATH', __DIR__ . '/');
define('APPPATH', __DIR__ . '/application/');
\spl_autoload_register(function($item) {
$path_items = \explode('\\', \ltrim($item, '\\'));
// If the namespace is a straight mapping to the class, just load it
$simple_path = \implode('/', $path_items);
$file = BASEPATH . "{$simple_path}.php";
if (file_exists($file))
{
require_once($file);
return;
}
// Check the application folder
$file = str_replace("Sleepy", 'application', $file);
if (file_exists($file))
{
require_once($file);
return;
}
});
$i = new \Sleepy\Core\Input();
$o = new \Sleepy\Core\Output($i);
$browser = \get_browser(NULL);
$browser->browser_name_regex = utf8_encode($browser->browser_name_regex);
$o->set_data(['json','html'], [
'$_SERVER' => $i->server(),
'$_GET' => $i->get(),
'$_POST' => $i->post(),
'$_ENV' => $i->env(),
'$_COOKIE' => $i->cookie(),
'browser' => $browser,
'raw headers' => $i->header(),
'parsed headers' => $i->header_array()
]);
// End of index.php