Register the bindings for the JSON Web Token provider.

@return void
193532
protected function registerJWTProvider()
    {
        $this->app->singleton('tymon.jwt.provider.jwt', function ($app) {
            $provider = $this->config('providers.jwt');

            return new $provider(
                $this->config('secret'),
                $this->config('algo'),
                $this->config('keys')
            );
        });
    }
621048
public function register()
    {
        $tokens = array();
        foreach ($this->newTypeCasts as $token => $versions) {
            if (\defined($token)) {
                $tokens[] = constant($token);
            }
        }

        /*
         * Work around tokenizer issues.
         *
         * - (binary) cast is incorrectly tokenized as T_STRING_CAST by PHP and PHPCS.
         * - b"something" binary cast is incorrectly tokenized as T_CONSTANT_ENCAPSED_STRING by PHP and PHPCS.
         * - Since PHPCS 3.4.0, PHPCS *will* tokenize these correctly.
         *
         * @link https://github.com/squizlabs/PHP_CodeSniffer/issues/1574
         */
        if (version_compare(PHPCSHelper::getVersion(), '3.4.0', '<') === true) {
            $tokens[] = \T_STRING_CAST;
            $tokens[] = \T_CONSTANT_ENCAPSED_STRING;
        }

        return $tokens;
    }
530708
public function register()
	{
		$this->app['db'] = function($app)
		{
			// @FIXME: this isn't pretty, but it will shim the removal of the old mysql_* calls from php
			$driver = (Config::get('dbtype') == 'mysql') ? 'pdo' : Config::get('dbtype');

			$options = [
				'driver'   => $driver,
				'host'     => Config::get('host'),
				'user'     => Config::get('user'),
				'password' => Config::get('password'),
				'database' => Config::get('db'),
				'prefix'   => Config::get('dbprefix')
			];

			return Driver::getInstance($options);
		};
	}
324483
protected function registerAssets()
    {
        $view = $this->getView();
        $clientOptions = Json::encode($this->clientOptions);
        $js = 'jQuery("div#' . $this->options['id'] . '").raty(' . $clientOptions . ');';
        $view->registerJs($js);
    }
219632
public function register()
    {
        $this->di->setShared(
            'authServer',

            function () {
                /* @var \Pails\Container $this */

                // Init repositories
                $clientRepository = new ClientRepository();
                $scopeRepository = new ScopeRepository();
                $accessTokenRepository = new AccessTokenRepository();
                $authCodeRepository = new AuthCodeRepository();
                $userRepository = new UserRepository();
                $refreshTokenRepository = new RefreshTokenRepository();

                // Keys
                $privateKey = $this['config']->get('oauth2.private_key');
                $publicKey = $this['config']->get('oauth2.public_key');

                // Setup authorization server
                $server = new AuthorizationServer(
                    $clientRepository,
                    $accessTokenRepository,
                    $scopeRepository,
                    $privateKey,
                    $publicKey);

                if ($this['config']->get('oauth2.client_credential.enabled')) {
                    // clientGrant
                    $server->enableGrantType(
                        new ClientCredentialsGrant(),
                        seconds2interval($this['config']->get('oauth2.client_credential.token_ttl', 3600))
                    );
                }

                if ($this['config']->get('oauth2.password.enabled')) {
                    // passwordGrant
                    $passwordGrant = new PasswordGrant(
                        $userRepository,
                        $refreshTokenRepository
                    );
                    $passwordGrant->setRefreshTokenTTL(seconds2interval($this['config']->get('oauth2.password.refresh_token_ttl', 2592000)));
                    $server->enableGrantType(
                        $passwordGrant,
                        seconds2interval($this['config']->get('oauth2.password.token_ttl', 3600))
                    );
                }

                if ($this['config']->get('oauth2.auth_code.enabled')) {
                    // authCodeGrant
                    $authCodeGrant = new AuthCodeGrant(
                        $authCodeRepository,
                        $refreshTokenRepository,
                        seconds2interval($this['config']->get('oauth2.auth_code.code_ttl', 3600))
                    );
                    $authCodeGrant->setRefreshTokenTTL(seconds2interval($this['config']->get('oauth2.auth_code.refresh_token_ttl', 2592000)));
                    $server->enableGrantType(
                        $authCodeGrant,
                        seconds2interval($this['config']->get('oauth2.auth_code.token_ttl', 3600))
                    );
                }

                if ($this['config']->get('oauth2.refresh_token.enabled')) {
                    // refreshTokenGrant
                    $refreshTokenGrant = new RefreshTokenGrant(
                        $refreshTokenRepository
                    );
                    $server->enableGrantType(
                        $refreshTokenGrant,
                        seconds2interval($this['config']->get('oauth2.refresh_token.token_ttl', 3600))
                    );
                }

                if ($this['config']->get('oauth2.implicit.enabled')) {
                    // implicit grant
                    $server->enableGrantType(
                        new ImplicitGrant(seconds2interval($this['config']->get('oauth2.implicit.token_ttl', 3600))),
                        seconds2interval($this['config']->get('oauth2.implicit.token_ttl', 3600))
                    );
                }

                return $server;
            }
        );

        $this->di->setShared(
            'resourceServer',

            function () {
                /* @var \Pails\Container $this */
                $accessTokenRepository = new AccessTokenRepository();
                $publicKey = $this['config']->get('oauth2.public_key');

                $resourceServer = new ResourceServer($accessTokenRepository, $publicKey);

                return $resourceServer;
            }
        );

        $this->di->setShared(
            'authClient',

            function () {
                /* @var \Pails\Container $this */
                $provider = new GenericProvider([
                    'clientId'                => $this['config']->get('oauth2.client.client_id'),
                    'clientSecret'            => $this['config']->get('oauth2.client.client_secret'),
                    'redirectUri'             => $this['config']->get('oauth2.client.redirect_url'),
                    'urlAuthorize'            => $this['config']->get('oauth2.client.authorize_url'),
                    'urlAccessToken'          => $this['config']->get('oauth2.client.access_token_url'),
                    'urlResourceOwnerDetails' => $this['config']->get('oauth2.client.resource_owner_url'),
                ]);

                return $provider;
            }
        );
    }
303818
protected function registerBindings()
    {
        $this->app->bind('flysystem.connection', function (Container $app) {
            $manager = $app['flysystem'];

            return $manager->connection();
        });

        $this->app->alias('flysystem.connection', Filesystem::class);
        $this->app->alias('flysystem.connection', FilesystemInterface::class);
    }
1092143
public function register()
    {
        $container = $this->getContainer();
        $config    = $container->get('config');

        $container->share(HandlerStack::class, function () {
            return HandlerStack::create();
        });

        // If access token was provided, then instantiate and add to middleware
        if ($config->has('access_token')
            && $config->get('access_token') !== null
        ) {

            // Convert the JSON serialized token into an `AccessToken` instance.
            $config->set(
                'access_token',
                new AccessToken(json_decode($config->get('access_token'), true))
            );
        }

        $this->addMiddleware();
    }
1210959
public function register()
    {
        $this->mergeConfigFrom(__DIR__.'/config/config.php', 'google');

        $this->app->bind('PulkitJalan\Google\Client', function ($app) {
            return new Client($app['config']['google']);
        });
    }
198716
protected function registerCustomBindings(): void
    {
        $repositoryFactory = $this->app->make(IRepositoryFactory::class);

        foreach (config('laravel_repositories.bindings') as $className => $repository) {
            $repositoryFactory->register($className, $repository);
        }
    }
1032755
public function register()
    {
        $this->registerLoader();

        $this->app->singleton('webklex.translator', function ($app) {
            return new Translator($app['webklex.translator.loader'], $app->getLocale());
        });
    }
756448
public static function registerHandlers()
    {
        if (self::$registered === true) {
            return;
        }

        // @todo check a conf file to load from that instead of
        // hardcoding into the library?
        $handlers = array(
            \Httpful\Mime::JSON => new \Httpful\Handlers\JsonHandler(),
            \Httpful\Mime::XML  => new \Httpful\Handlers\XmlHandler(),
            \Httpful\Mime::FORM => new \Httpful\Handlers\FormHandler(),
            \Httpful\Mime::CSV  => new \Httpful\Handlers\CsvHandler(),
        );

        foreach ($handlers as $mime => $handler) {
            // Don't overwrite if the handler has already been registered
            if (Httpful::hasParserRegistered($mime))
                continue;
            Httpful::register($mime, $handler);
        }

        self::$registered = true;
    }
1266950
public function register()
    {
        $this->app->singleton('JavaScript', function ($app) {
            return new Transformer(
                new LaravelViewBinder($app['events'], config('javascript.bind_js_vars_to_this_view')),
                config('javascript.js_namespace')
            );
        });

        $this->mergeConfigFrom(
            __DIR__ . '/config/javascript.php',
            'javascript'
        );
    }
934392
protected function registerProviders(): void
    {
        foreach ($this->providers as $provider) {
            $this->app->register($provider);
        }
    }
1360878
protected function registerJWT()
    {
        $this->app->singleton('tymon.jwt', function ($app) {
            return (new JWT(
                $app['tymon.jwt.manager'],
                $app['tymon.jwt.parser']
            ))->lockSubject($this->config('lock_subject'));
        });
    }
79965
public function register()
    {
        $this->app->singleton(Collection::class, function ($app) {
            return new Collection();
        });
        $this->app->singleton(Item::class, function ($app) {
            return new Item();
        });
        $this->app->bind(Manager::class, function ($app) {
            $manager = new Manager();
            $request = app('Request');
            $manager->setSerializer(new JsonApiSerializer($request::getSchemeAndHttpHost()));
            return $manager;
        });
    }
1329203
public function register()
    {
        // Bind some classes related to the Google Ads API client library for
        // PHP.
        $this->app->bind(
            'Google\AdsApi\AdWords\AdWordsServices',
            function () {
                return new AdWordsServices();
            }
        );
        $this->app->bind(
            'Google\Auth\FetchAuthTokenInterface',
            function () {
                // Generate a refreshable OAuth2 credential for authentication
                // from the config file.
                return (new OAuth2TokenBuilder())->fromFile(
                    config('app.adsapi_php_path')
                )->build();
            }
        );
        $this->app->bind(
            'Google\AdsApi\AdWords\AdWordsSessionBuilder',
            function () {
                return new AdWordsSessionBuilder();
            }
        );

    }
856
protected function registerJWTAuth()
    {
        $this->app->singleton('tymon.jwt.auth', function ($app) {
            return (new JWTAuth(
                $app['tymon.jwt.manager'],
                $app['tymon.jwt.provider.auth'],
                $app['tymon.jwt.parser']
            ))->lockSubject($this->config('lock_subject'));
        });
    }