src/SmsServiceProvider.php
/**
     * Register bindings in the container.
     */
Register bindings in the container.
Register bindings in the container .
public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/laravel-ovh-sms.php',
            'laravel-ovh-sms'
        );
        $config = $this->app['config']->get('laravel-ovh-sms');
        $this->app->singleton(SmsApi::class, function ($app) use ($config) {
            $credentials = collect($config);
            $credentials = $credentials
                ->only(
                    [
                        'app_key',
                        'app_secret',
                        'consumer_key',
                        'endpoint'
                    ]
                )
                ->toArray();
            return new SmsApi(
                $credentials['app_key'],
                $credentials['app_secret'],
                $credentials['endpoint'],
                $credentials['consumer_key']
            );
        });
        $this->app->singleton(Sms::class, function ($app) use ($config) {
            return new OvhSms($app->make(SmsApi::class), $config);
        });
    }
public function register ( ) { $ this -> mergeConfigFrom ( __DIR__ . '/../config/laravel-ovh-sms.php' , 'laravel-ovh-sms' ) ; $ config = $ this -> app [ 'config' ] -> get ( 'laravel-ovh-sms' ) ; $ this -> app -> singleton ( SmsApi :: class , function ( $ app ) use ( $ config ) { $ credentials = collect ( $ config ) ; $ credentials = $ credentials -> only ( [ 'app_key' , 'app_secret' , 'consumer_key' , 'endpoint' ] ) -> toArray ( ) ; return new SmsApi ( $ credentials [ 'app_key' ] , $ credentials [ 'app_secret' ] , $ credentials [ 'endpoint' ] , $ credentials [ 'consumer_key' ] ) ; } ) ; $ this -> app -> singleton ( Sms :: class , function ( $ app ) use ( $ config ) { return new OvhSms ( $ app -> make ( SmsApi :: class ) , $ config ) ; } ) ; }
Register bindings in the container.
Register bindings in the container .
// merge config // resolve SmsApi as a singleton // resolve OvhSms as a singleton