/**
  * Register the logger class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerLogger(Application $app)
 {
     $app->singleton('logger', function ($app) {
         $loggers = [];
         foreach ($app->config->get('logger.loggers', []) as $logger => $levels) {
             $loggers[] = new LevelAwareLogger($app->make($logger), (array) $levels);
         }
         return new LoggerWrapper($loggers);
     });
     $app->alias('logger', LoggerWrapper::class);
     $app->alias('logger', LoggerInterface::class);
     $app->alias('logger', Log::class);
 }
 /**
  * Register the user verification.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerUserVerification(Application $app)
 {
     $app->bind('user.verification', function ($app) {
         return new UserVerification(app()->make('mailer'), app()->make('db')->connection()->getSchemaBuilder());
     });
     $app->alias('user.verification', UserVerification::class);
 }
示例#3
0
 /**
  * Register the git client class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerGitlib(Application $app)
 {
     $app->singleton('gitlib', function ($app) {
         return new BaseClient(null);
     });
     $app->alias('gitlib', BaseClient::class);
 }
 /**
  * Register the bindings.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerBindings(Application $app)
 {
     $app->bind('telegram.bot', function ($app) {
         $manager = $app['telegram'];
         return $manager->bot();
     });
     $app->alias('telegram.bot', Api::class);
 }
 /**
  * Register the security class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerSecurity(Application $app)
 {
     $app->singleton('security', function ($app) {
         $evil = $app->config->get('security.evil');
         return new Security($evil);
     });
     $app->alias('security', Security::class);
 }
 /**
  * Register the bindings.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerBindings(Application $app)
 {
     $app->bind('cachet.connection', function ($app) {
         $manager = $app['cachet'];
         return $manager->connection();
     });
     $app->alias('cachet.connection', CachetConnection::class);
 }
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('pusher', function ($app) {
         $config = $app['config'];
         $factory = $app['pusher.factory'];
         return new PusherManager($config, $factory);
     });
     $app->alias('pusher', 'Vinkla\\Pusher\\PusherManager');
 }
 /**
  * @param Application $app
  */
 private function registerUrlShortener($app)
 {
     $this->mergeConfigFrom(__DIR__ . '/../lj-shortener.php', 'lj-shortener');
     $app->singleton('lj.shortener', function () {
         $cfg = config('lj-shortener');
         return new Shortener(null, false, $cfg);
     });
     $app->alias('lj.shortener', Shortener::class);
 }
示例#9
0
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('hashids', function ($app) {
         $config = $app['config'];
         $factory = $app['hashids.factory'];
         return new HashidsManager($config, $factory);
     });
     $app->alias('hashids', 'Vinkla\\Hashids\\HashidsManager');
 }
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('twitter', function ($app) {
         $config = $app['config'];
         $factory = $app['twitter.factory'];
         return new TwitterManager($config, $factory);
     });
     $app->alias('twitter', 'EliuFlorez\\Twitter\\TwitterManager');
 }
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('flysystem', function ($app) {
         $config = $app['config'];
         $factory = $app['flysystem.factory'];
         return new FlysystemManager($config, $factory);
     });
     $app->alias('flysystem', 'GrahamCampbell\\Flysystem\\FlysystemManager');
 }
示例#12
0
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('vimeo', function ($app) {
         $config = $app['config'];
         $factory = $app['vimeo.factory'];
         return new VimeoManager($config, $factory);
     });
     $app->alias('vimeo', 'Vinkla\\Vimeo\\VimeoManager');
 }
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('opensearch', function ($app) {
         $config = $app['config'];
         $factory = $app['opensearch.factory'];
         return new OpensearchManager($config, $factory);
     });
     $app->alias('opensearch', 'Orzcc\\Opensearch\\OpensearchManager');
 }
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('topclient', function ($app) {
         $config = $app['config'];
         $factory = $app['topclient.factory'];
         return new TopClientManager($config, $factory);
     });
     $app->alias('topclient', 'Orzcc\\TopClient\\TopClientManager');
 }
示例#15
0
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('vineq', function ($app) {
         $factory = $app['vineq.factory'];
         $manager = new VineQManager($factory);
         return $manager->createConnection();
     });
     $app->alias('vineq', VineQ::class);
 }
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('instagram', function ($app) {
         $config = $app['config'];
         $factory = $app['instagram.factory'];
         return new InstagramManager($config, $factory);
     });
     $app->alias('instagram', 'Vinkla\\Instagram\\InstagramManager');
 }
 /**
  * Register the manager class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerManager(Application $app)
 {
     $app->singleton('cloudflareapi', function ($app) {
         $config = $app['config'];
         $factory = $app['cloudflareapi.factory'];
         return new CloudFlareAPIManager($config, $factory);
     });
     $app->alias('cloudflareapi', 'GrahamCampbell\\CloudFlareAPI\\CloudFlareAPIManager');
 }
 /**
  * Register the binput class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerBinput(Application $app)
 {
     $app->singleton('binput', function ($app) {
         $request = $app['request'];
         $security = $app['security'];
         $binput = new Binput($request, $security);
         $app->refresh('request', $binput, 'setRequest');
         return $binput;
     });
     $app->alias('binput', Binput::class);
 }
 /**
  * Initialize Telegram Bot SDK Library with Default Config.
  *
  * @param Application $app
  */
 protected function registerTelegram(Application $app)
 {
     $app->singleton(Api::class, function ($app) {
         $config = $app['config'];
         $telegram = new Api($config->get('telegram.bot_token', false), $config->get('telegram.async_requests', false), $config->get('telegram.http_client_handler', null));
         // Register Commands
         $telegram->addCommands($config->get('telegram.commands', []));
         return $telegram;
     });
     $app->alias(Api::class, 'telegram');
 }
示例#20
0
 /**
  * Load the aliases.
  *
  * @return \Jenky\LaravelEnvLoader\Loader
  */
 public function loadAliases()
 {
     $this->loadData(config('env.aliases'), function ($configs) {
         if (!empty($configs) && is_array($configs)) {
             foreach ($configs as $alias => $class) {
                 $this->app->alias($alias, $class);
             }
         }
     });
     return $this;
 }
示例#21
0
 /**
  * Registers the server in the container.
  *
  * @return \Illuminate\Foundation\Application
  * @throws \Exception
  */
 public function register()
 {
     // Auto register the support service provider
     if (!get_class($this) == SupportServiceProvider::class) {
         $this->app->register(SupportServiceProvider::class);
     }
     $this->viewsPath = Str::replace($this->viewsPath, '{resourcesPath}', $this->getResourcesPath());
     $this->assetsPath = Str::replace($this->assetsPath, '{resourcesPath}', $this->getResourcesPath());
     $router = $this->app->make('router');
     $kernel = $this->app->make('Illuminate\\Contracts\\Http\\Kernel');
     $this->registerConfigFiles();
     foreach ($this->prependMiddleware as $middleware) {
         $kernel->prependMiddleware($middleware);
     }
     foreach ($this->middleware as $middleware) {
         $kernel->pushMiddleware($middleware);
     }
     foreach ($this->routeMiddleware as $key => $middleware) {
         $router->middleware($key, $middleware);
     }
     foreach ($this->providers as $provider) {
         $this->app->register($provider);
     }
     foreach ($this->deferredProviders as $provider) {
         $this->app->registerDeferredProvider($provider);
     }
     foreach ($this->bindings as $binding => $class) {
         $this->app->bind($binding, $class);
     }
     foreach ($this->singletons as $binding => $class) {
         if ($this->strict && !class_exists($class) && !interface_exists($class)) {
             throw new \Exception(get_called_class() . ": Could not find alias class [{$class}]. This exception is only thrown when \$strict checking is enabled");
         }
         $this->app->singleton($binding, $class);
     }
     foreach ($this->aliases as $alias => $full) {
         if ($this->strict && !class_exists($full) && !interface_exists($full)) {
             throw new \Exception(get_called_class() . ": Could not find alias class [{$full}]. This exception is only thrown when \$strict checking is enabled");
         }
         $this->app->alias($alias, $full);
     }
     if (is_array($this->commands) and count($this->commands) > 0) {
         $this->commands($this->commands);
     }
     AliasLoader::getInstance($this->facades)->register();
     $this->requireHelpersFor('register');
     return $this->app;
 }
 /**
  * Register the Authorization server with the IoC container.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 public function registerAuthorizer(Application $app)
 {
     $app->singleton('oauth2-server.authorizer', function ($app) {
         $config = $app['config']->get('oauth2');
         $issuer = $app->make(AuthorizationServer::class)->setClientStorage($app->make(ClientInterface::class))->setSessionStorage($app->make(SessionInterface::class))->setAuthCodeStorage($app->make(AuthCodeInterface::class))->setAccessTokenStorage($app->make(AccessTokenInterface::class))->setRefreshTokenStorage($app->make(RefreshTokenInterface::class))->setScopeStorage($app->make(ScopeInterface::class))->requireScopeParam($config['scope_param'])->setDefaultScope($config['default_scope'])->requireStateParam($config['state_param'])->setScopeDelimiter($config['scope_delimiter'])->setAccessTokenTTL($config['access_token_ttl']);
         // add the supported grant types to the authorization server
         foreach ($config['grant_types'] as $grantIdentifier => $grantParams) {
             $grant = $app->make($grantParams['class']);
             $grant->setAccessTokenTTL($grantParams['access_token_ttl']);
             if (array_key_exists('callback', $grantParams)) {
                 list($className, $method) = array_pad(explode('@', $grantParams['callback']), 2, 'verify');
                 $verifier = $app->make($className);
                 $grant->setVerifyCredentialsCallback([$verifier, $method]);
             }
             if (array_key_exists('auth_token_ttl', $grantParams)) {
                 $grant->setAuthTokenTTL($grantParams['auth_token_ttl']);
             }
             if (array_key_exists('refresh_token_ttl', $grantParams)) {
                 $grant->setRefreshTokenTTL($grantParams['refresh_token_ttl']);
             }
             if (array_key_exists('rotate_refresh_tokens', $grantParams)) {
                 $grant->setRefreshTokenRotation($grantParams['rotate_refresh_tokens']);
             }
             $issuer->addGrantType($grant);
         }
         $checker = $app->make(ResourceServer::class);
         $authorizer = new Authorizer($issuer, $checker);
         $authorizer->setRequest($app['request']);
         $authorizer->setTokenType($app->make($config['token_type']));
         $app->refresh('request', $authorizer, 'setRequest');
         return $authorizer;
     });
     $app->alias('oauth2-server.authorizer', Authorizer::class);
 }
 /**
  * Register the bindings.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerBindings(Application $app)
 {
     $app->bind('hashids.connection', function ($app) {
         $manager = $app['hashids'];
         return $manager->connection();
     });
     $app->alias('hashids.connection', Hashids::class);
 }
 /**
  * Register the bindings.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerBindings(Application $app)
 {
     $app->bind('flysystem.connection', function ($app) {
         $manager = $app['flysystem'];
         return $manager->connection();
     });
     $app->alias('flysystem.connection', Filesystem::class);
     $app->alias('flysystem.connection', FilesystemInterface::class);
 }
 /**
  * Register the bindings.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerBindings(Application $app)
 {
     $app->bind('transip.connection', function ($app) {
         $manager = $app['transip'];
         return $manager->connection();
     });
     $app->alias('transip.connection', Client::class);
 }
示例#26
0
 /**
  * Register the bindings.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerBindings(Application $app)
 {
     $app->bind('pusher.connection', function ($app) {
         $manager = $app['pusher'];
         return $manager->connection();
     });
     $app->alias('pusher.connection', Pusher::class);
 }
 /**
  * Register the markdown compiler class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerCompiler(Application $app)
 {
     $app->singleton('markdown.compiler', function ($app) {
         $markdown = $app['markdown'];
         $files = $app['files'];
         $storagePath = $app->config->get('view.compiled');
         return new MarkdownCompiler($markdown, $files, $storagePath);
     });
     $app->alias('markdown.compiler', MarkdownCompiler::class);
 }
 /**
  * Register the bindings.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerBindings(Application $app)
 {
     $app->bind('mailchimp.connection', function ($app) {
         $manager = $app['mailchimp'];
         return $manager->connection();
     });
     $app->alias('mailchimp.connection', Mailchimp::class);
 }
示例#29
0
 /**
  * Register the github document repository class.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @return void
  */
 protected function registerGithubDocumentRepository(Application $app)
 {
     $app->bind('blogit.github.repository.document', function ($app) {
         $client = $app['blogit.github.client'];
         return new DocumentRepository($client);
     });
     $app->alias('blogit.github.repository.document', DocumentRepositoryInterface::class);
 }
示例#30
0
 /**
  * Register the htmlmin class.
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  *
  * @return void
  */
 protected function registerHTMLMin(Application $app)
 {
     $app->singleton('htmlmin', function ($app) {
         $blade = $app['htmlmin.blade'];
         $css = $app['htmlmin.css'];
         $js = $app['htmlmin.js'];
         $html = $app['htmlmin.html'];
         return new HTMLMin($blade, $css, $js, $html);
     });
     $app->alias('htmlmin', 'GrahamCampbell\\HTMLMin\\HTMLMin');
 }