-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathDriverManager.php
More file actions
271 lines (226 loc) · 5.99 KB
/
Copy pathDriverManager.php
File metadata and controls
271 lines (226 loc) · 5.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<?php
namespace SimpleSoftwareIO\SMS;
use GuzzleHttp\Client;
use Illuminate\Support\Manager;
use SimpleSoftwareIO\SMS\Drivers\CallFireSMS;
use SimpleSoftwareIO\SMS\Drivers\EmailSMS;
use SimpleSoftwareIO\SMS\Drivers\EZTextingSMS;
use SimpleSoftwareIO\SMS\Drivers\FlowrouteSMS;
use SimpleSoftwareIO\SMS\Drivers\JustSendSMS;
use SimpleSoftwareIO\SMS\Drivers\LabsMobileSMS;
use SimpleSoftwareIO\SMS\Drivers\LogSMS;
use SimpleSoftwareIO\SMS\Drivers\MozeoSMS;
use SimpleSoftwareIO\SMS\Drivers\NexmoSMS;
use SimpleSoftwareIO\SMS\Drivers\PlivoSMS;
use SimpleSoftwareIO\SMS\Drivers\SMS77;
use SimpleSoftwareIO\SMS\Drivers\TwilioSMS;
use SimpleSoftwareIO\SMS\Drivers\ZenviaSMS;
class DriverManager extends Manager
{
/**
* Get the default sms driver name.
*
* @return string
*/
public function getDefaultDriver()
{
return $this->app['config']['sms.driver'];
}
/**
* Set the default sms driver name.
*
* @param string $name
*/
public function setDefaultDriver($name)
{
$this->app['config']['sms.driver'] = $name;
}
/**
* Create an instance of the Log driver.
*
* @return LogSMS
*/
protected function createLogDriver()
{
$provider = new LogSMS($this->app['log']);
return $provider;
}
/**
* Create an instance of the CallFire driver.
*
* @return CallFireSMS
*/
protected function createCallfireDriver()
{
$config = $this->app['config']->get('sms.callfire', []);
$provider = new CallFireSMS(
new Client(),
$config['app_login'],
$config['app_password']
);
return $provider;
}
/**
* Creates an instance of the EMail driver.
*
* @return EmailSMS
*/
protected function createEmailDriver()
{
$provider = new EmailSMS($this->app['mailer']);
return $provider;
}
/**
* Create an instance of the EZTexting driver.
*
* @return EZTextingSMS
*/
protected function createEztextingDriver()
{
$config = $this->app['config']->get('sms.eztexting', []);
$provider = new EZTextingSMS(new Client());
$data = [
'User' => $config['username'],
'Password' => $config['password'],
];
$provider->buildBody($data);
return $provider;
}
/**
* Create an instance of the LabsMobile driver.
*
* @return LabsMobileSMS
*/
protected function createLabsMobileDriver()
{
$config = $this->app['config']->get('sms.labsmobile', []);
$provider = new LabsMobileSMS(new Client());
$auth = [
'username' => $config['username'],
'password' => $config['password'],
];
$provider->buildBody($auth);
return $provider;
}
/**
* Create an instance of the Mozeo driver.
*
* @return MozeoSMS
*/
protected function createMozeoDriver()
{
$config = $this->app['config']->get('sms.mozeo', []);
$provider = new MozeoSMS(new Client());
$auth = [
'companykey' => $config['company_key'],
'username' => $config['username'],
'password' => $config['password'],
];
$provider->buildBody($auth);
return $provider;
}
/**
* Create an instance of the nexmo driver.
*
* @return NexmoSMS
*/
protected function createNexmoDriver()
{
$config = $this->app['config']->get('sms.nexmo', []);
$provider = new NexmoSMS(
new Client(),
$config['api_key'],
$config['api_secret']
);
return $provider;
}
/**
* Create an instance of the Twillo driver.
*
* @return TwilioSMS
*/
protected function createTwilioDriver()
{
$config = $this->app['config']->get('sms.twilio', []);
return new TwilioSMS(
new \Services_Twilio($config['account_sid'], $config['auth_token']),
$config['auth_token'],
$this->app['request']->url(),
$config['verify']
);
}
/**
* Create an instance of the Zenvia driver.
*
* @return ZenviaSMS
*/
protected function createZenviaDriver()
{
$config = $this->app['config']->get('sms.zenvia', []);
$provider = new ZenviaSMS(
new Client(),
$config['account_key'],
$config['passcode'],
$config['callbackOption']
);
return $provider;
}
/**
* Create an instance of the Plivo driver.
*
* @return PlivoSMS
*/
protected function createPlivoDriver()
{
$config = $this->app['config']->get('sms.plivo', []);
$provider = new PlivoSMS(
$config['auth_id'],
$config['auth_token']
);
return $provider;
}
/**
* Create an instance of the flowroute driver.
*
* @return FlowrouteSMS
*/
protected function createFlowrouteDriver()
{
$config = $this->app['config']->get('sms.flowroute', []);
$provider = new FlowrouteSMS(
new Client(),
$config['access_key'],
$config['secret_key']
);
return $provider;
}
/**
* Create an instance of the SMS77 driver.
*
* @return SMS77
*/
protected function createSms77Driver()
{
$config = $this->app['config']->get('sms.sms77', []);
$provider = new SMS77(
new Client(),
$config['user'],
$config['api_key'],
$config['debug']
);
return $provider;
}
/**
* Create an instance of the justsend driver.
*
* @return JustSendSMS
*/
protected function createJustSendDriver()
{
$config = $this->app['config']->get('sms.justsend', []);
$provider = new JustSendSMS(
$config['api_key']
);
return $provider;
}
}