-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChannelProviderInterface.php
More file actions
76 lines (71 loc) · 2.2 KB
/
Copy pathChannelProviderInterface.php
File metadata and controls
76 lines (71 loc) · 2.2 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
<?php
declare(strict_types=1);
namespace Crustum\Notification\Extension;
use Crustum\Notification\Registry\ChannelRegistry;
/**
* Channel Provider Interface
*
* Defines the contract for channel plugins to register themselves with the core
* notification system. Channel providers enable a decentralized plugin ecosystem
* where each notification channel can be developed, distributed, and maintained
* independently.
*
* Example Usage:
* ```
* class TelegramChannelProvider implements ChannelProviderInterface
* {
* public function provides(): array
* {
* return ['telegram'];
* }
*
* public function register(ChannelRegistry $registry): void
* {
* $registry->load('telegram', [
* 'className' => TelegramChannel::class,
* ]);
* }
*
* public function getDefaultConfig(): array
* {
* return [
* 'token' => env('TELEGRAM_BOT_TOKEN'),
* 'timeout' => 30,
* ];
* }
* }
* ```
*/
interface ChannelProviderInterface
{
/**
* Get channel names provided by this provider
*
* Returns an array of channel names that this provider will register.
* This allows the core system to discover what channels are available.
*
* @return array<string> List of channel names (e.g., ['telegram', 'slack'])
*/
public function provides(): array;
/**
* Register channels with the registry
*
* Called during the channel discovery process to register the provider's
* channels with the core ChannelRegistry. The provider should load its
* channels using the registry's load() method.
*
* @param \Crustum\Notification\Registry\ChannelRegistry $registry The channel registry
* @return void
*/
public function register(ChannelRegistry $registry): void;
/**
* Get default configuration for the channel
*
* Returns the default configuration array that will be merged with
* user-provided configuration. This typically includes API keys,
* timeouts, and other service-specific settings.
*
* @return array<string, mixed> Default configuration array
*/
public function getDefaultConfig(): array;
}