src/BugsnagServiceProvider.php
public function register()
    {
        $this->app->singleton('bugsnag', function (Container $app) {
            $config = $app->config->get('bugsnag');
            $client = new Client(new Configuration($config['api_key']), new LaravelResolver($app), $this->getGuzzle($config));

            $this->setupCallbacks($client, $app, $config);
            $this->setupPaths($client, $app->basePath(), $app->path(), isset($config['strip_path']) ? $config['strip_path'] : null, isset($config['project_root']) ? $config['project_root'] : null);

            $client->setReleaseStage(isset($config['release_stage']) ? $config['release_stage'] : $app->environment());
            $client->setHostname(isset($config['hostname']) ? $config['hostname'] : null);

            $client->setFallbackType($app->runningInConsole() ? 'Console' : 'HTTP');
            $client->setAppType(isset($config['app_type']) ? $config['app_type'] : null);
            $client->setAppVersion(isset($config['app_version']) ? $config['app_version'] : null);
            $client->setBatchSending(isset($config['batch_sending']) ? $config['batch_sending'] : true);
            $client->setSendCode(isset($config['send_code']) ? $config['send_code'] : true);
            $client->getPipeline()->insertBefore(new UnhandledState(), 'Bugsnag\\Middleware\\SessionData');

            $client->setNotifier([
                'name' => 'Bugsnag Laravel',
                'version' => static::VERSION,
                'url' => 'https://github.com/bugsnag/bugsnag-laravel',
            ]);

            if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
                $client->setNotifyReleaseStages($config['notify_release_stages']);
            }

            if (isset($config['filters']) && is_array($config['filters'])) {
                $client->setFilters($config['filters']);
            }

            if (isset($config['auto_capture_sessions']) && $config['auto_capture_sessions']) {
                $endpoint = isset($config['session_endpoint']) ? $config['session_endpoint'] : null;
                $this->setupSessionTracking($client, $endpoint, $this->app->events);
            }

            if (isset($config['build_endpoint'])) {
                $client->setBuildEndpoint($config['build_endpoint']);
            }

            return $client;
        });

        $this->app->singleton('bugsnag.tracker', function () {
            return new Tracker();
        });

        $this->app->singleton('bugsnag.logger', function (Container $app) {
            $config = $app->config->get('bugsnag');
            $logger = interface_exists(Log::class) ? new LaravelLogger($app['bugsnag'], $app['events']) : new BugsnagLogger($app['bugsnag']);
            if (isset($config['logger_notify_level'])) {
                $logger->setNotifyLevel($config['logger_notify_level']);
            }

            return $logger;
        });

        $this->app->singleton('bugsnag.multi', function (Container $app) {
            return interface_exists(Log::class) ? new MultiLogger([$app['log'], $app['bugsnag.logger']]) : new BaseMultiLogger([$app['log'], $app['bugsnag.logger']]);
        });

        if ($this->app['log'] instanceof LogManager) {
            $this->app['log']->extend('bugsnag', function (Container $app, array $config) {
                $handler = new PsrHandler($app['bugsnag.logger']);

                return new Logger('bugsnag', [$handler]);
            });
        }

        $this->app->alias('bugsnag', Client::class);
        $this->app->alias('bugsnag.tracker', Tracker::class);
        $this->app->alias('bugsnag.logger', interface_exists(Log::class) ? LaravelLogger::class : BugsnagLogger::class);
        $this->app->alias('bugsnag.multi', interface_exists(Log::class) ? MultiLogger::class : BaseMultiLogger::class);
    }
public function register()
    {
        $this->app->singleton('bugsnag', function (Container $app) {
            $config = $app->config->get('bugsnag');
            $client = new Client(new Configuration($config['api_key']), new LaravelResolver($app), $this->getGuzzle($config));

            $this->setupCallbacks($client, $app, $config);
            $this->setupPaths($client, $app->basePath(), $app->path(), isset($config['strip_path']) ? $config['strip_path'] : null, isset($config['project_root']) ? $config['project_root'] : null);

            $client->setReleaseStage(isset($config['release_stage']) ? $config['release_stage'] : $app->environment());
            $client->setHostname(isset($config['hostname']) ? $config['hostname'] : null);

            $client->setFallbackType($app->runningInConsole() ? 'Console' : 'HTTP');
            $client->setAppType(isset($config['app_type']) ? $config['app_type'] : null);
            $client->setAppVersion(isset($config['app_version']) ? $config['app_version'] : null);
            $client->setBatchSending(isset($config['batch_sending']) ? $config['batch_sending'] : true);
            $client->setSendCode(isset($config['send_code']) ? $config['send_code'] : true);
            $client->getPipeline()->insertBefore(new UnhandledState(), 'Bugsnag\\Middleware\\SessionData');

            $client->setNotifier([
                'name' => 'Bugsnag Laravel',
                'version' => static::VERSION,
                'url' => 'https://github.com/bugsnag/bugsnag-laravel',
            ]);

            if (isset($config['notify_release_stages']) && is_array($config['notify_release_stages'])) {
                $client->setNotifyReleaseStages($config['notify_release_stages']);
            }

            if (isset($config['filters']) && is_array($config['filters'])) {
                $client->setFilters($config['filters']);
            }

            if (isset($config['auto_capture_sessions']) && $config['auto_capture_sessions']) {
                $endpoint = isset($config['session_endpoint']) ? $config['session_endpoint'] : null;
                $this->setupSessionTracking($client, $endpoint, $this->app->events);
            }

            if (isset($config['build_endpoint'])) {
                $client->setBuildEndpoint($config['build_endpoint']);
            }

            return $client;
        });

        $this->app->singleton('bugsnag.tracker', function () {
            return new Tracker();
        });

        $this->app->singleton('bugsnag.logger', function (Container $app) {
            $config = $app->config->get('bugsnag');
            $logger = interface_exists(Log::class) ? new LaravelLogger($app['bugsnag'], $app['events']) : new BugsnagLogger($app['bugsnag']);
            if (isset($config['logger_notify_level'])) {
                $logger->setNotifyLevel($config['logger_notify_level']);
            }

            return $logger;
        });

        $this->app->singleton('bugsnag.multi', function (Container $app) {
            return interface_exists(Log::class) ? new MultiLogger([$app['log'], $app['bugsnag.logger']]) : new BaseMultiLogger([$app['log'], $app['bugsnag.logger']]);
        });

        if ($this->app['log'] instanceof LogManager) {
            $this->app['log']->extend('bugsnag', function (Container $app, array $config) {
                $handler = new PsrHandler($app['bugsnag.logger']);

                return new Logger('bugsnag', [$handler]);
            });
        }

        $this->app->alias('bugsnag', Client::class);
        $this->app->alias('bugsnag.tracker', Tracker::class);
        $this->app->alias('bugsnag.logger', interface_exists(Log::class) ? LaravelLogger::class : BugsnagLogger::class);
        $this->app->alias('bugsnag.multi', interface_exists(Log::class) ? MultiLogger::class : BaseMultiLogger::class);
    }
public function register ( ) { $ this -> app -> singleton ( 'bugsnag' , function ( Container $ app ) { $ config = $ app -> config -> get ( 'bugsnag' ) ; $ client = new Client ( new Configuration ( $ config [ 'api_key' ] ) , new LaravelResolver ( $ app ) , $ this -> getGuzzle ( $ config ) ) ; $ this -> setupCallbacks ( $ client , $ app , $ config ) ; $ this -> setupPaths ( $ client , $ app -> basePath ( ) , $ app -> path ( ) , isset ( $ config [ 'strip_path' ] ) ? $ config [ 'strip_path' ] : null , isset ( $ config [ 'project_root' ] ) ? $ config [ 'project_root' ] : null ) ; $ client -> setReleaseStage ( isset ( $ config [ 'release_stage' ] ) ? $ config [ 'release_stage' ] : $ app -> environment ( ) ) ; $ client -> setHostname ( isset ( $ config [ 'hostname' ] ) ? $ config [ 'hostname' ] : null ) ; $ client -> setFallbackType ( $ app -> runningInConsole ( ) ? 'Console' : 'HTTP' ) ; $ client -> setAppType ( isset ( $ config [ 'app_type' ] ) ? $ config [ 'app_type' ] : null ) ; $ client -> setAppVersion ( isset ( $ config [ 'app_version' ] ) ? $ config [ 'app_version' ] : null ) ; $ client -> setBatchSending ( isset ( $ config [ 'batch_sending' ] ) ? $ config [ 'batch_sending' ] : true ) ; $ client -> setSendCode ( isset ( $ config [ 'send_code' ] ) ? $ config [ 'send_code' ] : true ) ; $ client -> getPipeline ( ) -> insertBefore ( new UnhandledState ( ) , 'Bugsnag\\Middleware\\SessionData' ) ; $ client -> setNotifier ( [ 'name' => 'Bugsnag Laravel' , 'version' => static :: VERSION , 'url' => 'https://github.com/bugsnag/bugsnag-laravel' , ] ) ; if ( isset ( $ config [ 'notify_release_stages' ] ) && is_array ( $ config [ 'notify_release_stages' ] ) ) { $ client -> setNotifyReleaseStages ( $ config [ 'notify_release_stages' ] ) ; } if ( isset ( $ config [ 'filters' ] ) && is_array ( $ config [ 'filters' ] ) ) { $ client -> setFilters ( $ config [ 'filters' ] ) ; } if ( isset ( $ config [ 'auto_capture_sessions' ] ) && $ config [ 'auto_capture_sessions' ] ) { $ endpoint = isset ( $ config [ 'session_endpoint' ] ) ? $ config [ 'session_endpoint' ] : null ; $ this -> setupSessionTracking ( $ client , $ endpoint , $ this -> app -> events ) ; } if ( isset ( $ config [ 'build_endpoint' ] ) ) { $ client -> setBuildEndpoint ( $ config [ 'build_endpoint' ] ) ; } return $ client ; } ) ; $ this -> app -> singleton ( 'bugsnag.tracker' , function ( ) { return new Tracker ( ) ; } ) ; $ this -> app -> singleton ( 'bugsnag.logger' , function ( Container $ app ) { $ config = $ app -> config -> get ( 'bugsnag' ) ; $ logger = interface_exists ( Log :: class ) ? new LaravelLogger ( $ app [ 'bugsnag' ] , $ app [ 'events' ] ) : new BugsnagLogger ( $ app [ 'bugsnag' ] ) ; if ( isset ( $ config [ 'logger_notify_level' ] ) ) { $ logger -> setNotifyLevel ( $ config [ 'logger_notify_level' ] ) ; } return $ logger ; } ) ; $ this -> app -> singleton ( 'bugsnag.multi' , function ( Container $ app ) { return interface_exists ( Log :: class ) ? new MultiLogger ( [ $ app [ 'log' ] , $ app [ 'bugsnag.logger' ] ] ) : new BaseMultiLogger ( [ $ app [ 'log' ] , $ app [ 'bugsnag.logger' ] ] ) ; } ) ; if ( $ this -> app [ 'log' ] instanceof LogManager ) { $ this -> app [ 'log' ] -> extend ( 'bugsnag' , function ( Container $ app , array $ config ) { $ handler = new PsrHandler ( $ app [ 'bugsnag.logger' ] ) ; return new Logger ( 'bugsnag' , [ $ handler ] ) ; } ) ; } $ this -> app -> alias ( 'bugsnag' , Client :: class ) ; $ this -> app -> alias ( 'bugsnag.tracker' , Tracker :: class ) ; $ this -> app -> alias ( 'bugsnag.logger' , interface_exists ( Log :: class ) ? LaravelLogger :: class : BugsnagLogger :: class ) ; $ this -> app -> alias ( 'bugsnag.multi' , interface_exists ( Log :: class ) ? MultiLogger :: class : BaseMultiLogger :: class ) ; }
Register the service provider.

@return void
Register the service provider .