Exemplo n.º 1
0
<?php

// Create new app
$app = new App\Application();
// Add the config first
require __DIR__ . '/../app/config/config.php';
// Core silex providers
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app->register(new Silex\Provider\HttpFragmentServiceProvider());
// Twig
$app->register(new Silex\Provider\TwigServiceProvider(), ['twig.path' => __DIR__ . '/../app/views']);
// Spot2 provider
$app->register(new Ronanchilvers\Silex\Provider\Spot2ServiceProvider(), ['spot2.connections' => $app['spot2.connections']]);
return $app;
Exemplo n.º 2
0
//     'Illuminate\View\Middleware\ShareErrorsFromSession',
// ]);
// $app->routeMiddleware([
//     'auth' => App\Http\Middleware\Authenticate::class,
// ]);
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/
$app->register(App\Providers\AppServiceProvider::class);
//$app->register(\Illuminate\Session\SessionServiceProvider::class);
// $app->register(App\Providers\AuthServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class);
/*
|--------------------------------------------------------------------------
| Load The Application Routes
|--------------------------------------------------------------------------
|
| Next we will include the routes file so that they can all be added to
| the application. This will provide all of the URLs the application
| can respond to, as well as the controllers that may handle them.
|
*/
$app->group(['namespace' => 'App\\Http\\Controllers'], function ($app) {
    require __DIR__ . '/../app/Http/routes.php';
Exemplo n.º 3
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
$parser = new Symfony\Component\Yaml\Yaml();
$global = $parser->parse(dirname(__DIR__) . '/config/global.yml');
$config = $parser->parse(sprintf(dirname(__DIR__) . '/config/%s.yml', $global['environment']));
$security = $parser->parse(dirname(__DIR__) . '/config/security.yml');
$routes = $parser->parse(dirname(__DIR__) . '/config/routes.yml');
$app = new App\Application(array_merge($global, $config, $security, $routes));
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views', 'twig.form.templates' => array('template/layout.html.twig')));
$app->get("/admin", "App\\Controller\\AdminController::index");
/** Doctrine cli-config also uses this bootstrap for db etc, so don't run HTTP stuff if cli is being used **/
isset($cli) ?: $app->run();