public function register(ContainerInterface $app) { $app->closure(PheanstalkInterface::class, function ($app) { return new Pheanstalk(config('queue.host', '127.0.0.1'), config('queue.port', Pheanstalk::DEFAULT_PORT), config('queue.timeout'), config('queue.connect_persistent', false)); }); $app->bind(SerializerInterface::class, PhpSerializer::class); $app->bind(AdapterInterface::class, BeanstalkdAdapter::class); }
public function register(ContainerInterface $app) { $app->bind(ClassLoaderInterface::class, WanduLoader::class); $app->bind(ResponsifierInterface::class, WanduResponsifier::class); $app->closure(Configuration::class, function () { return new Configuration(['middleware' => config('router.middleware', [Parameterify::class, Sessionify::class]), 'virtual_method_enabled' => true, 'cache_disabled' => config('router.cache_disabled', true), 'cache_file' => path(config('router.cache_file', null))]); }); $app->bind(Dispatcher::class); $app->alias('router', Dispatcher::class); }
public function register(ContainerInterface $app) { $app->bind(ServerRequestFactory::class); $app->bind(UploadedFileFactory::class); $app->bind(ResponseFactory::class); $app->bind(ResponseSender::class); $app->closure(Uploader::class, function (ContainerInterface $app) { return new Uploader($app['config']->get('file.upload')); }); }
/** * {@inheritdoc} */ public function register(ContainerInterface $app) { $app->closure(Manager::class, function () { $capsule = new Manager(); foreach (config('database.connections', []) as $name => $connection) { $capsule->addConnection($connection, $name); } return $capsule; }); $app->alias('database', Manager::class); $app->bind(MigrateTemplateInterface::class, MigrateTemplate::class); $app->bind(MigrateAdapterInterface::class, MigrateAdapter::class); }
public function register(ContainerInterface $app) { $app->bind(ClassLoaderInterface::class, WanduLoader::class); $app->closure(Dispatcher::class, function (ContainerInterface $app) { return new Dispatcher($app[ClassLoaderInterface::class], ['virtual_method_disabled' => false, 'cache_disabled' => $app['config']->get('router.cache_disabled', true), 'cache_file' => $app['config']->get('router.cache_file', null)]); }); $app->alias('router', Dispatcher::class); }
/** * {@inheritdoc} */ public function execute(ContainerInterface $app) { $this->useErrorHandling(); if (!$app->has(HttpErrorHandlerInterface::class)) { $app->bind(HttpErrorHandlerInterface::class, DefaultHttpErrorHandler::class); } /* @var \Psr\Http\Message\ServerRequestInterface $request */ $request = $this->createRequest($app); try { $response = $this->dispatch($app->get(Dispatcher::class), $request); } catch (Throwable $exception) { return $this->handleException($exception); } catch (Exception $exception) { return $this->handleException($exception); } return $this->sendResponse($response); }
public function register(ContainerInterface $app) { $app->bind(CookieJarFactory::class); $app->closure(SessionAdapterInterface::class, function (ContainerInterface $app) { switch ($app['config']->get('session.type')) { case "file": return new FileAdapter($app['config']->get('session.path'), $app['config']->get('session.timeout', 7200)); case "global": return new GlobalAdapter(); case "redis": return new RedisAdapter(new Client($app['config']->get('session.path')), $app['config']->get('session.timeout', 7200)); } throw new RuntimeException("unknown session type."); }); $app->closure(SessionFactory::class, function (ContainerInterface $app) { return new SessionFactory($app[SessionAdapterInterface::class], ['timeout' => $app['config']->get('session.timeout', 7200), 'name' => $app['config']->get('session.name', "FestivSessId")]); }); }
public function register(ContainerInterface $app) { $app->bind(HttpErrorHandlerInterface::class, DefaultHttpErrorHandler::class); }
public function register(ContainerInterface $app) { $app->bind('whoops', Run::class); }
public function register(ContainerInterface $app) { $app->bind(CasterInterface::class, Caster::class); }
public function register(ContainerInterface $app) { foreach ($this->repositories as $repository) { $app->bind($repository); } }
public function register(ContainerInterface $app) { $app->bind(Hasher::class, BcryptHasher::class); }