Register the service provider.

@param Application $app
428802
public function register(Application $app)
    {        
        // direct api
        $app['direct.api'] = function() use ($app){
            return new Api($app);
        };
        
        // direct router
        $app['direct.router'] = function() use ($app){
            return new Router($app);
        };

        // redefine the Silex detault route class
        $app['route_class'] = 'Direct\\Silex\\Route';

        // default configs
        $app['direct.bundles'] = isset($app['direct.bundles']) ? $app['direct.bundles'] : array();
        $app['direct.responseEncode'] = isset($app['direct.responseEncode']) ? $app['direct.responseEncode'] : true;
        $app['direct.requestDecode'] = isset($app['direct.requestDecode']) ? $app['direct.requestDecode'] : true;
        $app['direct.route.pattern'] = isset($app['direct.route.pattern']) ? $app['direct.route.pattern'] : '/route';
        $app['direct.api.type'] = isset($app['direct.api.type']) ? $app['direct.api.type'] : 'remoting';
        $app['direct.api.namespace'] = isset($app['direct.api.namespace']) ? $app['direct.api.namespace'] : 'Actions';
        $app['direct.api.id'] = isset($app['direct.api.id']) ? $app['direct.api.id'] : 'API';
        $app['direct.exception.message'] = isset($app['direct.exception.message']) ? $app['direct.exception.message'] : 'Whoops, looks like something went wrong.';

    }
450400
protected function registerFactory(Application $app)
    {
        $app->singleton('cloudflareapi.factory', function () {
            $client = new Factories\ClientFactory();

            return new Factories\CloudFlareAPIFactory($client);
        });

        $app->alias('cloudflareapi.factory', 'GrahamCampbell\CloudFlareAPI\Factories\CloudFlareAPIFactory');
    }
891252
protected function registerBitbucketFactory(Application $app) {
        $app->singleton('bitbucket.factory', function ($app) {
            $auth = $app['bitbucket.authfactory'];
            $path = $app['path.storage'] . '/bitbucket';
            return new BitbucketFactory($auth, $path);
        });
        $app->alias('bitbucket.factory', BitbucketFactory::class);
    }
325895
protected function registerAutoloader($app)
    {
        // now configure a new autoloader spl configuration
        $autoloaderApp = new Doozr_Loader_Autoloader_Spl_Config();
        $autoloaderApp
            ->_namespace($app->namespace)
            ->namespaceSeparator('_')
            ->addExtension('php')
            ->path(substr($app->path, 0, -1))
            ->description('Autoloader for App classes with namespace: "'.$app->namespace.'"')
            ->priority(0);

        Doozr_Loader_Autoloader_Spl_Facade::attach([$autoloaderApp]);
    }
1357493
public function register(Application $app)
    {
        $app['migrations.create-proxy'] = $app->share(function ($app) {
            $command = new CreateMigrationCommandProxy('migrations:create');
            $command->setFactory($app->raw('migrations.create'))
                ->setApp($app);
            return $command;
        });

        $app['migrations.create'] = $app->share(function ($app) {
            $view = new CreateMigrationView($app['mustache']);

            $command = new CreateMigrationCommand($view);

            $config = $app['config']->load('init');

            if (isset($config['migrations_namespace'])) {
                $command->setMigrationNamespace($config['migrations_namespace']);
            }

            return $command;
        });

        $app['migrations.run-proxy'] = $app->share(function ($app) {
            $command = new RunMigrationsCommandProxy('migrations:run');
            $command->setFactory($app->raw('migrations.run'))
                ->setApp($app);
            return $command;
        });

        $app['migrations.run'] = $app->share(function ($app) {
            $command = new RunMigrationsCommand();

            $command->setDatabaseAdapter($app['db']);

            $config = $app['config']->load('init');

            if (isset($config['migrations_namespace'])) {
                $command->setMigrationNamespace($config['migrations_namespace']);
            }

            return $command;
        });
    }
1223952
public function register(Application $app)
    {
        $app['events.order_subscriber'] = $app->share(function (Application $app) {
            $notifierRegistry = new ValidationNotifierRegistry();

            $notifierRegistry->registerNotifier(Order::NOTIFY_MAIL, new MailNotifier($app));
            $notifierRegistry->registerNotifier(Order::NOTIFY_WEBHOOK, new WebhookNotifier(
                new LazyLocator($app, 'manipulator.webhook-event')
            ));

            return new OrderSubscriber($app, $notifierRegistry);
        });
    }
1169236
public function register(App $app)
    {
        $app["hooks.service"] = function (App $app) {
            return new \SlaxWeb\Hooks\Container($app["logger.service"]("System"));
        };

        $app["newHook.factory"] = $app->factory(
            function (App $app) {
                return new \SlaxWeb\Hooks\Hook;
            }
        );
    }
480292
protected function registerBindings(Application $app) {
        $app->bind('bitbucket.connection', function ($app) {
            $manager = $app['bitbucket'];
            return $manager->connection();
        });
        $app->alias('bitbucket.connection', Api::class);
    }
1088386
public function register(Application $app)
    {
        $app[Service::PASSWORD_HASH] = $app->share(function () use ($app) {
            return new Service\DefaultPasswordHashService();
        });
    }
1055507
public function register($app)
    {
        $app['events']->listen(CacheHit::class, [$this, 'recordCacheHit']);
        $app['events']->listen(CacheMissed::class, [$this, 'recordCacheMissed']);

        $app['events']->listen(KeyWritten::class, [$this, 'recordKeyWritten']);
        $app['events']->listen(KeyForgotten::class, [$this, 'recordKeyForgotten']);
    }
1029100
public function register(Application $app)
    {
        $app['redis'] = $app->share(function ($app) {
            $config = $app['config'];
            $redis = new \Redis();
            if (!$redis->connect($config['redis']['host'], $config['redis']['port'])) {
                throw new \RuntimeException('Unable to connect to redis server');
            }
            return $redis;
        });
    }
1297222
public function register(Application $app)
    {
        if (!isset($app['descriptor.builder'])) {
            throw new Exception\MissingDependencyException(
                'The builder object that is used to construct the ProjectDescriptor is missing'
            );
        }

        $app['parser'] = $app->share(
            function ($app) {
                $parser = new Parser();
                $parser->setStopwatch($app['kernel.stopwatch']);
                $parser->setLogger($app['monolog']);

                return $parser;
            }
        );

        $app['markdown'] = $app->share(
            function () {
                return \Parsedown::instance();
            }
        );

        /** @var Translator $translator  */
        $translator = $app['translator'];
        $translator->addTranslationFolder(__DIR__ . DIRECTORY_SEPARATOR . 'Messages');

        $app['parser.files'] = new Collection();
        $app->command(new ParseCommand($app['descriptor.builder'], $app['parser'], $translator, $app['parser.files']));
    }
312065
public function register(Container $app)
    {
        $routerContainer = new RouterContainer();
        $app[Map::class] = $routerContainer->getMap();
        $app[RuleIterator::class] = $routerContainer->getRuleIterator();
    }
1224454
public function registerMiddlewareBindings(Application $app)
    {
        $app->singleton(CheckAuthCodeRequestMiddleware::class, function ($app) {
            return new CheckAuthCodeRequestMiddleware($app['oauth2-server.authorizer']);
        });

        $app->singleton(OAuthMiddleware::class, function ($app) {
            $httpHeadersOnly = $app['config']->get('oauth2.http_headers_only');

            return new OAuthMiddleware($app['oauth2-server.authorizer'], $httpHeadersOnly);
        });

        $app->singleton(OAuthClientOwnerMiddleware::class, function ($app) {
            return new OAuthClientOwnerMiddleware($app['oauth2-server.authorizer']);
        });

        $app->singleton(OAuthUserOwnerMiddleware::class, function ($app) {
            return new OAuthUserOwnerMiddleware($app['oauth2-server.authorizer']);
        });
    }
138471
public function register(\Silex\Application $app)
    {
        parent::register($app);

        // Register voters
        $app->extend('security.voters', function($voters) {
            return array_merge($voters, $this->voters);
        });

        // Add reference to this in application instance
        $this->app = $app;
        $this->app['securilex'] = $this;
    }
1261623
public function boot (Application $app) {
        if (isset($app[self::NS . ".default_args"]) && is_array($app[self::NS . ".default_args"])) {
            $this -> getPreserialiser($app) -> setDefaultArgs($app[self::NS . ".default_args"]);
        } else {
        }
    }
81030
public function register(Application $app)
    {
        $app[Validator::LOGIN] = $app->share(function () use ($app) {
            return new Validator\SymfonyLoginValidator($app['validator']);
        });
        $app[Validator::REGISTRATION] = $app->share(function () use ($app) {
            return new Validator\SymfonyRegistrationValidator($app['validator']);
        });
    }