File tree Expand file tree Collapse file tree 2 files changed +25
-26
lines changed Expand file tree Collapse file tree 2 files changed +25
-26
lines changed Original file line number Diff line number Diff line change 3
3
"description" : " Laravel notification driver for WhatsApp" ,
4
4
"homepage" : " https://github.com/laravel-notification-channels/whatsapp" ,
5
5
"license" : " MIT" ,
6
+ "keywords" : [
7
+ " whatsapp notification" ,
8
+ " laravel" ,
9
+ " whatsapp" ,
10
+ " notification" ,
11
+ " whatsapp notifications channel"
12
+ ],
6
13
"authors" : [
7
14
{
8
15
"name" : " Álex Albarca" ,
14
21
"require" : {
15
22
"php" : " >=7.4" ,
16
23
"illuminate/notifications" : " ~6.0 || ~7.0 || ~8.0" ,
17
- "illuminate/support" : " ~6.0 || ~7.0 || ~8.0"
24
+ "illuminate/support" : " ~6.0 || ~7.0 || ~8.0" ,
25
+ "netflie/whatsapp-cloud-api" : " ^1.3.1"
18
26
},
19
27
"require-dev" : {
20
28
"mockery/mockery" : " ^1.0" ,
30
38
"NotificationChannels\\ WhatsApp\\ Test\\ " : " tests"
31
39
}
32
40
},
41
+ "extra" : {
42
+ "laravel" : {
43
+ "providers" : [
44
+ " NotificationChannels\\ WhatsApp\\ WhatsAppServiceProvider"
45
+ ]
46
+ }
47
+ },
33
48
"scripts" : {
34
49
"test" : " phpunit" ,
35
50
"test:coverage" : " phpunit --coverage-text --coverage-clover=coverage.clover"
Original file line number Diff line number Diff line change 3
3
namespace NotificationChannels \WhatsApp ;
4
4
5
5
use Illuminate \Support \ServiceProvider ;
6
+ use Netflie \WhatsAppCloudApi \WhatsAppCloudApi ;
6
7
7
8
class WhatsAppServiceProvider extends ServiceProvider
8
9
{
9
- /**
10
- * Bootstrap the application services.
11
- */
12
- public function boot ()
13
- {
14
- // Bootstrap code here.
15
-
16
- /**
17
- * Here's some example code we use for the pusher package.
18
-
19
- $this->app->when(Channel::class)
20
- ->needs(Pusher::class)
21
- ->give(function () {
22
- $pusherConfig = config('broadcasting.connections.pusher');
23
-
24
- return new Pusher(
25
- $pusherConfig['key'],
26
- $pusherConfig['secret'],
27
- $pusherConfig['app_id']
28
- );
29
- });
30
- */
31
-
32
- }
33
-
34
10
/**
35
11
* Register the application services.
36
12
*/
37
13
public function register ()
38
14
{
15
+ $ config = [
16
+ 'from_phone_number_id ' => $ this ->app ->make ('config ' )->get ('services.whatsapp.from-phone-number-id ' ),
17
+ 'access_token ' => $ this ->app ->make ('config ' )->get ('services.whatsapp.token ' ),
18
+ 'graph_version ' => $ this ->app ->make ('config ' )->get ('services.whatsapp.graph_version ' , WhatsAppCloudApi::DEFAULT_GRAPH_VERSION ),
19
+ 'timeout ' => $ this ->app ->make ('config ' )->get ('services.whatsapp.timeout ' ),
20
+ ];
21
+
22
+ $ this ->app ->bind (WhatsAppCloudApi::class, static fn () => new WhatsAppCloudApi ($ config ));
39
23
}
40
24
}
You can’t perform that action at this time.
0 commit comments