<?php /** * * Bootstrap file. * Including this file into your application * will protect you from evil and bring good luck. * */ /** * Spark */ $app = Spark\Application::boot(); /** * Middleware */ $app->setMiddleware(['Relay\\Middleware\\ResponseSender', 'Spark\\Handler\\ExceptionHandler', 'Spark\\Handler\\RouteHandler', 'Spark\\Handler\\ContentHandler', 'Spark\\Handler\\ActionHandler']); /** * Routes */ $app->addRoutes(function (Spark\Router $r) { // aura payload stuff ? $r->get('/shifts', 'Spark\\Project\\Domain\\Shift\\GetList'); // root domain path $r->get('/', 'Spark\\Project\\Domain\\Index'); // static page includer $r->get('/static[/{name}]', 'Spark\\Project\\Domain\\StaticPage'); // $r->get('/hello[/{name}]', 'Spark\\Project\\Domain\\Hello'); // $r->post('/hello[/{name}]', 'Spark\Project\Domain\Hello'); // zsolt
<?php // Include Composer autoloader require __DIR__ . '/../vendor/autoload.php'; Spark\Application::build()->setConfiguration([Spark\Configuration\AurynConfiguration::class, Spark\Configuration\EnvConfiguration::class, Spark\Configuration\DiactorosConfiguration::class, Spark\Configuration\PayloadConfiguration::class, Spark\Configuration\RelayConfiguration::class, Spark\Configuration\WhoopsConfiguration::class, Spark\Project\Configuration\FluentPDOConfiguration::class, Spark\Project\Configuration\DataMapperConfiguration::class, Spark\Project\Configuration\AuthConfiguration::class, Spark\Project\Configuration\AclConfiguration::class])->setMiddleware([Relay\Middleware\ResponseSender::class, Spark\Handler\ExceptionHandler::class, Spark\Handler\DispatchHandler::class, Spark\Handler\JsonContentHandler::class, Spark\Handler\FormContentHandler::class, Spark\Auth\AuthHandler::class, Spark\Project\Middleware\AclMiddleware::class, Spark\Handler\ActionHandler::class])->setRouting(Spark\Project\Routing::class)->run();
// require __DIR__ . '/../src/hacks.php'; // require __DIR__ . '/../src/Exception/AuthException.php'; // REMOVE THIS use Illuminate\Database\Capsule\Manager as Capsule; /** * Configure the database and boot Eloquent */ $capsule = new Capsule(); $capsule->addConnection(['driver' => 'mysql', 'host' => 'localhost', 'database' => 'spark-project', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => '']); $capsule->setAsGlobal(); $capsule->bootEloquent(); // set timezone for timestamps etc date_default_timezone_set('UTC'); $auth = new \ShiftApi\Service\Auth(); $injector = new \Auryn\Injector(); $injector->share($auth); $paramsHelper = new \ShiftApi\Service\ParamsHelper(); $injector->share($paramsHelper); $app = Spark\Application::boot($injector); $app->setMiddleware(['Relay\\Middleware\\ResponseSender', 'Spark\\Handler\\ExceptionHandler', 'Spark\\Handler\\RouteHandler', 'Spark\\Handler\\ActionHandler']); $app->addRoutes(function (Spark\Router $r) { $r->get('/shifts', 'Spark\\Project\\Domain\\ListShifts'); $r->post('/shifts', 'Spark\\Project\\Domain\\CreateShift'); $r->put('/shifts', 'Spark\\Project\\Domain\\UpdateShift'); $r->get('/me/shifts', 'Spark\\Project\\Domain\\ListMyShifts'); $r->get('/me/shifts/{id}', 'Spark\\Project\\Domain\\ShowMyShift'); $r->get('/employees', 'Spark\\Project\\Domain\\ListEmployees'); $r->get('/employees/{id}', 'Spark\\Project\\Domain\\ShowEmployee'); // $r->get('/me/workweeks/{date}', 'Spark\\Project\\Domain\\ShowWorkweekByDate'); }); $app->run();
<?php // Include Composer autoloader require __DIR__ . '/../vendor/autoload.php'; use Spark\Action; use trejeraos\SimpleServerMonitor\Domain; use trejeraos\SimpleServerMonitor\Responder\TemplateResponder; Spark\Application::build()->setConfiguration([Spark\Configuration\AurynConfiguration::class, Spark\Configuration\DiactorosConfiguration::class, Spark\Configuration\NegotiationConfiguration::class, Spark\Configuration\PayloadConfiguration::class, Spark\Configuration\RelayConfiguration::class, trejeraos\SimpleServerMonitor\Configuration\FooConfiguration::class])->setMiddleware([Relay\Middleware\ResponseSender::class, Spark\Handler\ExceptionHandler::class, Spark\Handler\DispatchHandler::class, Spark\Handler\JsonContentHandler::class, Spark\Handler\FormContentHandler::class, trejeraos\SimpleServerMonitor\Auth\FooHandler::class, Spark\Handler\ActionHandler::class])->setRouting(function (Spark\Directory $directory) { return $directory->post('/auth', Domain\Login\Authenticate::class)->get('/test/hello[/{name}]', Domain\Test\Hello::class)->get('/test/plates[/{name}]', new Action(Domain\Test\HelloPlates::class, TemplateResponder::class))->put('/test/name', Domain\Test\Name::class)->get('/info/system', Domain\Monitor\System::class)->get('/info/cpu', Domain\Monitor\Cpu::class)->get('/info/memory', Domain\Monitor\Memory::class)->get('/info/swap', Domain\Monitor\Swap::class)->get('/info/network', Domain\Monitor\Network::class)->get('/info/bandwidth/{interface}[/{seconds}]', Domain\Monitor\Bandwidth::class)->get('/', new Action(Domain\Frontend::class, TemplateResponder::class)); // End of routing })->run();