コード例 #1
0
 public function register()
 {
     $this->app->singleton(['sms.sender' => SenderContract::class], function ($app) {
         $config = $app['config']['sms'];
         if (!$config || !is_array($config) || !array_key_exists('sender', $config)) {
             throw new Exception("SMS服务未进行配置");
         }
         $sender = $config['sender'];
         return SenderFactory::make($sender, $config, $app['httpClient'], $app['cache.store'], $app['log']);
     });
     $this->publishes(array(__DIR__ . '/config/' => config_path('')));
 }