{"id":20919588,"url":"https://github.com/tomatophp/filament-alerts","last_synced_at":"2025-04-06T10:10:31.706Z","repository":{"id":231921156,"uuid":"783044951","full_name":"tomatophp/filament-alerts","owner":"tomatophp","description":"Send notification to users using notification templates and multi notification channels, it's support Filament Native Notification Service with macro, and a full integration to FCM service worker notifications","archived":false,"fork":false,"pushed_at":"2025-01-27T11:15:17.000Z","size":4835,"stargazers_count":51,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T09:05:44.266Z","etag":null,"topics":["database","discord","email","fcm","filamentphp","filamentphp-plugin","integration","message-bird","notifications","pusher","slack"],"latest_commit_sha":null,"homepage":"https://tomatophp.com/en/open-source/filament-alerts","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomatophp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["3x1io"]}},"created_at":"2024-04-06T19:35:59.000Z","updated_at":"2025-03-22T12:27:40.000Z","dependencies_parsed_at":"2024-04-06T20:31:17.528Z","dependency_job_id":"2657ca27-a85c-43d4-8fe2-fbc7d0bc651d","html_url":"https://github.com/tomatophp/filament-alerts","commit_stats":{"total_commits":47,"total_committers":1,"mean_commits":47.0,"dds":0.0,"last_synced_commit":"b2d9132b2a4ebf7815930e3a7e41d4b03319ecf4"},"previous_names":["tomatophp/filament-alerts"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomatophp%2Ffilament-alerts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomatophp%2Ffilament-alerts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomatophp%2Ffilament-alerts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomatophp%2Ffilament-alerts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomatophp","download_url":"https://codeload.github.com/tomatophp/filament-alerts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464219,"owners_count":20942970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","discord","email","fcm","filamentphp","filamentphp-plugin","integration","message-bird","notifications","pusher","slack"],"created_at":"2024-11-18T17:07:58.862Z","updated_at":"2025-04-06T10:10:31.675Z","avatar_url":"https://github.com/tomatophp.png","language":"PHP","funding_links":["https://github.com/sponsors/3x1io"],"categories":[],"sub_categories":[],"readme":"![Screenshot](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/3x1io-tomato-alerts.jpg)\n\n# Filament Alerts Sender\n\n[![Dependabot Updates](https://github.com/tomatophp/filament-alerts/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/tomatophp/filament-alerts/actions/workflows/dependabot/dependabot-updates)\n[![PHP Code Styling](https://github.com/tomatophp/filament-alerts/actions/workflows/fix-php-code-styling.yml/badge.svg)](https://github.com/tomatophp/filament-alerts/actions/workflows/fix-php-code-styling.yml)\n[![Tests](https://github.com/tomatophp/filament-alerts/actions/workflows/tests.yml/badge.svg)](https://github.com/tomatophp/filament-alerts/actions/workflows/tests.yml)\n[![Latest Stable Version](https://poser.pugx.org/tomatophp/filament-alerts/version.svg)](https://packagist.org/packages/tomatophp/filament-alerts)\n[![License](https://poser.pugx.org/tomatophp/filament-alerts/license.svg)](https://packagist.org/packages/tomatophp/filament-alerts)\n[![Downloads](https://poser.pugx.org/tomatophp/filament-alerts/d/total.svg)](https://packagist.org/packages/tomatophp/filament-alerts)\n\nSend notification to users using notification templates and multi notification channels, it's support Filament Native Notification Service with macro, and a full integration to FCM service worker notifications\n\n## Features\n\n- [x] Send Notification to users using drivers\n- [x] Use Filament Native Notification\n- [x] Use Notification Templates\n- [x] Notification Logs\n- [x] Use Multiple Notification Channels\n- [x] Hide Notifications Resources\n- [x] Use Database Driver\n- [x] Use Email Driver\n- [x] Custom Driver Register\n- [x] Custom Type Register\n- [x] Custom Action Register\n- [x] Multi Users Register\n- [ ] Register Notification Templates\n\n## Screenshots\n\n![Templates](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/templates.png)\n![Create Template](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/create-template.png)\n![Create Template Image](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/create-template-v2.png)\n![Edit Template](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/edit-template.png)\n![Logs](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/logs.png)\n![Send Notification](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/send.png)\n![Try](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/try.png)\n![View Template](https://raw.githubusercontent.com/tomatophp/filament-alerts/master/arts/view-template.png)\n\n## Installation\n\n```bash\ncomposer require tomatophp/filament-alerts\n```\n\nafter install your package please run this command\n\n```bash\nphp artisan filament-alerts:install\n```\n\nif you are not using this package as a plugin please register the plugin on `/app/Providers/Filament/AdminPanelProvider.php`\n\n```php\n-\u003eplugin(\\TomatoPHP\\FilamentAlerts\\FilamentAlertsPlugin::make()\n)\n```\n\n## Usage\n\nto set up any model to get notifications you\n\n```php\n\u003c?php\n\nnamespace App\\Models;\n\nuse Illuminate\\Contracts\\Auth\\MustVerifyEmail;\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\nuse Illuminate\\Foundation\\Auth\\User as Authenticatable;\nuse Illuminate\\Notifications\\Notifiable;\nuse Laravel\\Fortify\\TwoFactorAuthenticatable;\nuse Laravel\\Jetstream\\HasProfilePhoto;\nuse Laravel\\Sanctum\\HasApiTokens;\nuse Spatie\\Permission\\Traits\\HasRoles;\nuse TomatoPHP\\FilamentAlerts\\Traits\\InteractsWithNotifications;\n\nclass User extends Authenticatable\n{\n    use HasApiTokens;\n    use HasFactory;\n    use HasProfilePhoto;\n    use Notifiable;\n    use TwoFactorAuthenticatable;\n    use HasRoles;\n    use InteractsWithNotifications;\n    ...\n```\n\n### Queue\n\nthe notification is run on queue, so you must run the queue worker to send the notifications\n\n```bash\nphp artisan queue:work\n```\n\n### Use Filament Native Notification\n\nyou can use the filament native notification and we add some `macro` for you\n\n```php\nuse Filament\\Notifications\\Notification;\n\nNotification::make('send')\n    -\u003etitle('Test Notifications')\n    -\u003ebody('This is a test notification')\n    -\u003eicon('heroicon-o-bell')\n    -\u003ecolor('success')\n    -\u003eactions([\n        \\Filament\\Notifications\\Actions\\Action::make('view')\n            -\u003elabel('View')\n            -\u003eurl('https://google.com')\n            -\u003emarkAsRead()\n    ])\n    -\u003esendUse(auth()-\u003euser(), \\TomatoPHP\\FilamentAlerts\\Services\\Drivers\\EmailDriver::class);\n  \n```\n\n### Notification Service\n\nto create a new template you can use template CRUD and make sure that the template key is unique because you will use it on every single notification.\n\n### Send Notification\n\nto send a notification you must use our helper SendNotification::class like\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Facades\\FilamentAlerts;\n\nFilamentAlerts::notify(User::first())\n    -\u003etemplate($template-\u003eid)\n    -\u003etitle([\n        \"find-text\" =\u003e \"change with this\"\n    ])\n    -\u003ebody([\n        \"find-text\" =\u003e \"change with this\"\n    ])\n    -\u003esend();\n```\n\nwhere `$template` is selected of the template by key or id, and title, body use to select and replace string on the template with custom data\n\n### Notification Channels\n\nyou can use multiple notification channels like\n\n- Email\n- Database\n- [Discord](https://www.github.com/tomatophp/filament-discord-driver)\n- [Firebase Cloud Messages](https://www.github.com/tomatophp/filament-fcm-driver)\n\nit can be working with direct user methods like\n\n```php\n$user-\u003enotifyEmail(string $message, ?string $subject = null, ?string $url = null);\n$user-\u003enotifyDB(string $message, ?string $title=null, ?string $url =null);\n```\n\n### Hide Notifications Resources\n\nto hide the notification resources from the sidebar you can use the plugin method `hideNotificationsResources` like\n\n```php\n-\u003eplugin(\\TomatoPHP\\FilamentAlerts\\FilamentAlertsPlugin::make()\n    -\u003ehideNotificationsResources()\n)\n```\n\n## Use Email Settings\n\nwe have build a Email settings to change your SMTP settings direct from GUI to allow this feature just add this method to the plugin\n\n```php\n-\u003eplugin(\\TomatoPHP\\FilamentAlerts\\FilamentAlertsPlugin::make()\n    -\u003euseSettingsHub()\n)\n```\n\n## Add Custom Driver\n\nyou can add a custom driver follow up `Driver` abstract class like this\n\n```php\n\u003c?php\n\nnamespace TomatoPHP\\FilamentAlerts\\Services\\Drivers;\n\nuse Filament\\Notifications\\Notification;\nuse TomatoPHP\\FilamentAlerts\\Jobs\\NotifyDatabaseJob;\n\nclass DatabaseDriver extends Driver\n{\n    public function setup(): void\n    {\n        // TODO: Implement setup() method.\n    }\n\n    public function sendIt(\n        string $title,\n        string $model,\n        int | string | null $modelId = null,\n        ?string $body = null,\n        ?string $url = null,\n        ?string $icon = null,\n        ?string $image = null,\n        ?string $type = 'info',\n        ?string $action = 'system',\n        ?array $data = [],\n        ?int $template_id = null,\n        ?Notification $notification = null\n    ): void {\n        if ($modelId) {\n            dispatch(new NotifyDatabaseJob([\n                'model_type' =\u003e $model,\n                'modelId' =\u003e $modelId,\n                'title' =\u003e $title,\n                'body' =\u003e $body,\n                'url' =\u003e $url,\n                'icon' =\u003e $icon,\n                'type' =\u003e $type,\n                'action' =\u003e $action,\n                'data' =\u003e $data,\n                'template_id' =\u003e $template_id,\n            ]));\n        } else {\n            foreach ($model::all() as $user) {\n                dispatch(new NotifyDatabaseJob([\n                    'model_type' =\u003e $model,\n                    'modelId' =\u003e $user-\u003eid,\n                    'title' =\u003e $title,\n                    'body' =\u003e $body,\n                    'url' =\u003e $url,\n                    'icon' =\u003e $icon,\n                    'type' =\u003e $type,\n                    'action' =\u003e $action,\n                    'data' =\u003e $data,\n                    'template_id' =\u003e $template_id,\n                ]));\n            }\n        }\n\n    }\n}\n\n```\n\n\nthen just use the facade service method in your service provider `boot()`\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Facades\\FilamentAlerts;\n\npublic function boot() {\n    FilamentAlerts::register(\n        \\TomatoPHP\\FilamentAlerts\\Services\\Concerns\\NotificationDriver::make('database')\n            -\u003elabel('Database')\n            -\u003ecolor('primary')\n            -\u003eicon('heroicon-o-bell')\n            -\u003edriver(\\TomatoPHP\\FilamentAlerts\\Services\\Drivers\\DatabaseDriver::class)\n    );\n} \n```\n\n## Register Custom Type\n\nyou can add a custom type using facade service method in your service provider `boot()`\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Facades\\FilamentAlerts;\n\npublic function boot() {\n    FilamentAlerts::register(\n        \\TomatoPHP\\FilamentAlerts\\Services\\Concerns\\NotificationType::make('system')\n            -\u003elabel('System')\n            -\u003ecolor('primary')\n            -\u003eicon('heroicon-o-bell')\n    );\n} \n```\n\n## Register Custom Action\n\nyou can add a custom action using facade service method in your service provider `boot()`\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Facades\\FilamentAlerts;\n\npublic function boot() {\n    FilamentAlerts::register(\n        \\TomatoPHP\\FilamentAlerts\\Services\\Concerns\\NotificationAction::make('system')\n            -\u003elabel('System')\n            -\u003ecolor('primary')\n            -\u003eicon('heroicon-o-bell')\n    );\n} \n```\n\n## Register Custom User Type\n\nyou can add a custom user type using facade service method in your service provider `boot()`\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Facades\\FilamentAlerts;\n\npublic function boot() {\n    FilamentAlerts::register(\n        \\TomatoPHP\\FilamentAlerts\\Services\\Concerns\\NotificationUser::make(User::class)\n            -\u003elabel('User')\n            -\u003ecolor('primary')\n            -\u003eicon('heroicon-o-bell')\n    );\n} \n```\n\n## User Alerts Resource Hooks\n\nwe have add a lot of hooks to make it easy to attach actions, columns, filters, etc\n\n### Table Columns\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateTable;\n\npublic function boot()\n{\n    NotificationsTemplateTable::register([\n        \\Filament\\Tables\\Columns\\TextColumn::make('something')\n    ]);\n}\n```\n\n### Table Actions\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateActions;\n\npublic function boot()\n{\n    NotificationsTemplateActions::register([\n        \\Filament\\Tables\\Actions\\ReplicateAction::make()\n    ]);\n}\n```\n\n### Table Filters\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateFilters;\n\npublic function boot()\n{\n    NotificationsTemplateFilters::register([\n        \\Filament\\Tables\\Filters\\SelectFilter::make('something')\n    ]);\n}\n```\n\n### Table Bulk Actions\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateBulkActions;\n\npublic function boot()\n{\n    NotificationsTemplateBulkActions::register([\n        \\Filament\\Tables\\BulkActions\\DeleteAction::make()\n    ]);\n}\n```\n\n### From Components\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Form\\NotificationsTemplateForm;\n\npublic function boot()\n{\n    NotificationsTemplateForm::register([\n        \\Filament\\Forms\\Components\\TextInput::make('something')\n    ]);\n}\n```\n\n### Page Actions\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Actions\\ManagePageActions;\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Actions\\EditPageActions;\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Actions\\ViewPageActions;\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Actions\\CreatePageActions;\n\npublic function boot()\n{\n    ManagePageActions::register([\n        Filament\\Actions\\Action::make('action')\n    ]);\n    \n    EditPageActions::register([\n        Filament\\Actions\\Action::make('action')\n    ]);\n    \n    ViewPageActions::register([\n        Filament\\Actions\\Action::make('action')\n    ]);\n    \n    CreatePageActions::register([\n        Filament\\Actions\\Action::make('action')\n    ]);\n}\n```\n\n### Infolist Entries\n\n```php\nuse TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Infolist\\NotificationsTemplateInfoList;\n\npublic function boot()\n{\n    NotificationsTemplateInfoList::register([\n       \\Filament\\Infolists\\Components\\TextEntry::make('something')\n    ]);\n}\n```\n\n## Custom Resource Classes\n\nyou can customize all resource classes to be any class you want with the same return from the config file\n\n```php\n/**\n * ---------------------------------------------\n * Resource Building\n * ---------------------------------------------\n * if you want to use the resource custom class\n */\n'resource' =\u003e [\n    'table' =\u003e [\n        'class' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateTable::class,\n        'filters' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateFilters::class,\n        'actions' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateActions::class,\n        'header-actions' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateHeaderActions::class,\n        'bulkActions' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Table\\NotificationsTemplateBulkActions::class,\n    ],\n    'form' =\u003e [\n        'class' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Form\\NotificationsTemplateForm::class,\n    ],\n    'infolist' =\u003e [\n        'class' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Infolist\\NotificationsTemplateInfoList::class,\n    ],\n    'pages' =\u003e [\n        'list' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Actions\\ManagePageActions::class,\n        'create' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Actions\\CreatePageActions::class,\n        'edit' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Actions\\EditPageActions::class,\n        'view' =\u003e \\TomatoPHP\\FilamentAlerts\\Filament\\Resources\\NotificationsTemplateResource\\Actions\\ViewPageActions::class,\n    ],\n]\n```\n\n\n## Publish Assets\n\nyou can publish config file by use this command\n\n```bash\nphp artisan vendor:publish --tag=\"filament-alerts-config\"\n```\n\nyou can publish views file by use this command\n\n```bash\nphp artisan vendor:publish --tag=\"filament-alerts-views\"\n```\n\nyou can publish languages file by use this command\n\n```bash\nphp artisan vendor:publish --tag=\"filament-alerts-lang\"\n```\n\nyou can publish migrations file by use this command\n\n```bash\nphp artisan vendor:publish --tag=\"filament-alerts-migrations\"\n```\n\n## Testing\n\nif you like to run `PEST` testing just use this command\n\n```bash\ncomposer test\n```\n\n## Code Style\n\nif you like to fix the code style just use this command\n\n```bash\ncomposer format\n```\n\n## PHPStan\n\nif you like to check the code by `PHPStan` just use this command\n\n```bash\ncomposer analyse\n```\n\n## Other Filament Packages\n\nCheckout our [Awesome TomatoPHP](https://github.com/tomatophp/awesome)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomatophp%2Ffilament-alerts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomatophp%2Ffilament-alerts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomatophp%2Ffilament-alerts/lists"}