-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.php
83 lines (62 loc) · 2.19 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
define('ENVIRONMENT', isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : 'production');
require_once "vendor/autoload.php";
require_once "config.php";
require_once "app/application.php";
// Controllers
require_once "app/controller.php";
require_once "app/controllers/login.controller.php";
require_once "app/controllers/ideas.controller.php";
// Models
require_once "app/models/BaseModel.php";
require_once "app/models/Idea.php";
define('APPLICATION', 'Share My Ideas');
define('VERSION', '1.0.0');
define('EXT', '.twig');
use Slim\Slim;
use Slim\Views\Twig as TwigView;
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
$app = new Slim(array(
'view' => new TwigView,
));
// Asset Management
$app->view()->parserExtensions = array(
new \Slim\Views\TwigExtension(),
);
/* Content Type Middleware */
$app->add(new \Slim\Middleware\ContentTypes());
$capsule = new Capsule;
$capsule->addConnection($db[ENVIRONMENT]);
$capsule->setEventDispatcher(new Dispatcher(new Container));
// If you want to use the Eloquent ORM...
$capsule->bootEloquent();
/* DB methods accessible via Slim instance */
$capsule->setAsGlobal();
/* Sentry Auth */
class_alias('Cartalyst\Sentry\Facades\Native\Sentry', 'Sentry');
$app->container->singleton(
'auth',
function () {
$hasher = new Cartalyst\Sentry\Hashing\NativeHasher;
$userProvider = new Cartalyst\Sentry\Users\Eloquent\Provider($hasher);
$groupProvider = new Cartalyst\Sentry\Groups\Eloquent\Provider;
$throttleProvider = new Cartalyst\Sentry\Throttling\Eloquent\Provider($userProvider);
$session = new Cartalyst\Sentry\Sessions\NativeSession;
$cookie = new Cartalyst\Sentry\Cookies\NativeCookie;
/* @var Cartalyst\Sentry\Facades\Native\Sentry $sentry */
$sentry = new Sentry(
$userProvider,
$groupProvider,
$throttleProvider,
$session,
$cookie
);
return $sentry::instance();
}
);
$c = new Application($app);
// Include Routes
require_once "app/routes.php";
$app->run();