{"id":14975181,"url":"https://github.com/damku999/excptionemail","last_synced_at":"2025-10-24T05:32:18.816Z","repository":{"id":56962572,"uuid":"375449228","full_name":"damku999/excptionemail","owner":"damku999","description":"Laravel Exception Notifications via emails","archived":false,"fork":false,"pushed_at":"2024-09-10T18:08:27.000Z","size":101,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-31T00:25:18.682Z","etag":null,"topics":["capture","debugging","email","email-notifications","error-handling","error-monitoring","exception","exception-email","exception-emails","exception-handling","laravel","laravel-exceptions","laravel-package","laravel8","mail","notification","php","php8"],"latest_commit_sha":null,"homepage":"","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/damku999.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-09T18:11:08.000Z","updated_at":"2024-09-10T18:09:06.000Z","dependencies_parsed_at":"2024-09-10T19:32:43.140Z","dependency_job_id":null,"html_url":"https://github.com/damku999/excptionemail","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":0.2692307692307693,"last_synced_commit":"2f8cdaa8df706e94551f64ef282d5d6d584fe39f"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damku999%2Fexcptionemail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damku999%2Fexcptionemail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damku999%2Fexcptionemail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damku999%2Fexcptionemail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damku999","download_url":"https://codeload.github.com/damku999/excptionemail/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237918710,"owners_count":19387305,"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":["capture","debugging","email","email-notifications","error-handling","error-monitoring","exception","exception-email","exception-emails","exception-handling","laravel","laravel-exceptions","laravel-package","laravel8","mail","notification","php","php8"],"created_at":"2024-09-24T13:51:40.228Z","updated_at":"2025-10-24T05:32:18.383Z","avatar_url":"https://github.com/damku999.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Exception Notifications\n\nAn easy-to-use package for sending email notifications with stack traces whenever an exception occurs in your Laravel application.\n\n![exceptionemail example image](exceptionemail.png?raw=true \"ExceptionEmail\")\n\n## Installation Guide\n\n### 1. Install via Composer\n\nTo install the package, run the following Composer command:\n\n```bash\ncomposer require darshan/exceptionemail\n```\n\n### 2. Configure Laravel\n\n#### Breaking Changes for Laravel 11: Exception Handling in a Custom Service Provider\n\nIn Laravel 11, exception handling logic should be placed in a custom service provider. Follow these steps to set it up:\n\n1. **Create a Custom Service Provider:**\n\nCreate a new service provider that will handle exceptions in your application. Add the following code in `app/Providers/ExceptionServiceProvider.php`:\n\n```php\nnamespace App\\Providers;\n\nuse Illuminate\\Support\\ServiceProvider;\nuse Throwable;\n\nclass ExceptionServiceProvider extends ServiceProvider\n{\n    public function register()\n    {\n        // Nothing here for now.\n    }\n\n    public function boot()\n    {\n        app()-\u003eerror(function (Throwable $e) {\n            app('exceptionemail')-\u003ecaptureException($e);\n        });\n    }\n}\n```\n\n2. **Register the Service Provider:**\n\nIn `bootstrap/providers.php`, register your custom `ExceptionServiceProvider` by adding it to the `providers` array:\n\n```php\nreturn [\n    // Other service providers...\n    App\\Providers\\ExceptionServiceProvider::class,\n],\n```\n\n#### Add ExceptionEmail's Exception Capturing (for version of Laravel below 11 like 8,9,10)\n\nIn order to capture exceptions and send emails (for Laravel versions prior to 11 or if you prefer using `Handler.php`), modify the `report` method in your `app/Exceptions/Handler.php` file:\n\n```php\nuse Throwable;\n\npublic function report(Throwable $exception)\n{\n    app('exceptionemail')-\u003ecaptureException($exception);\n\n    parent::report($exception);\n}\n```\n\n### 3. Publish the Configuration File\n\nPublish the ExceptionEmail configuration file by running the following Artisan command:\n\n```bash\nphp artisan vendor:publish --provider=\"Webmonks\\ExceptionEmail\\ExceptionEmailServiceProvider\"\n```\n\nThis will create a configuration file at `config/exceptionemail.php`.\n\n## Configuration\n\n### Silent Mode\n\nBy default, the package is configured with `'silent' =\u003e true` to prevent sending exception emails in development environments, especially when `'debug' =\u003e true` is enabled in Laravel.\n\nYou can control this behavior with the following configuration option:\n\n```php\n'silent' =\u003e env('IS_EXCEPTION_EMAIL_SILENT', true),\n```\n\nTo enable email notifications when exceptions occur, set `IS_EXCEPTION_EMAIL_SILENT=false` in your `.env` file.\n\n### Capture Exceptions\n\nYou can specify which types of exceptions should trigger email notifications. By default, the package includes `Symfony\\Component\\Debug\\Exception\\FatalErrorException::class`.\n\n```php\n'capture' =\u003e [\n    Symfony\\Component\\Debug\\Exception\\FatalErrorException::class,\n],\n```\n\nTo capture all exceptions, you can use the wildcard `'*'`:\n\n```php\n'capture' =\u003e [\n    '*'\n],\n```\n\n### Ignored Exceptions\n\nYou may define exceptions that should not trigger email notifications. This is done by adding them to the `ignored_exception` array.\n\n```php\n'ignored_exception' =\u003e [\n    // Webmonks\\ExceptionEmail\\Exceptions\\DummyException::class,\n],\n```\n\nFor example, to ignore `FatalErrorException`, use the following:\n\n```php\n'ignored_exception' =\u003e [\n    Symfony\\Component\\Debug\\Exception\\FatalErrorException::class,\n],\n```\n\n#### Usage in `Handler.php`\n\nUpdate the `report` method in `app/Exceptions/Handler.php` to incorporate ignored exceptions:\n\n```php\npublic function report(Exception $exception)\n{\n    if ($this-\u003eshouldReport($exception)) {\n        app('exceptionemail')-\u003ecaptureException($exception);\n    }\n\n    parent::report($exception);\n}\n```\n\n### Recipients\n\nSpecify the email addresses that should receive the exception notifications by updating the `to` array:\n\n```php\n'to' =\u003e [\n    'hello@example.com',\n],\n```\n\n### Ignored Bots\n\nYou can configure the package to ignore errors triggered by bots, like search engine crawlers. The default configuration includes common bots such as:\n\n```php\n'ignored_bots' =\u003e [\n    'googlebot',\n    'bingbot',\n    'slurp', \n    'ia_archiver',\n],\n```\n\n## Customizing Emails\n\nTo customize the subject and body of the error notification emails, publish the email templates by running:\n\n```bash\nphp artisan vendor:publish --provider=\"Webmonks\\ExceptionEmail\\ExceptionEmailServiceProvider\"\n```\n\n\u003e **Note:** Only run this command once to avoid overwriting custom changes.\n\nThe email views will be published to `resources/views/vendor/exceptionemail`. You can modify the templates as needed, and you have access to the `$exception` object in the views.\n\n## Testing the Integration\n\nTo verify that ExceptionEmail is correctly set up and working, use the following Artisan command:\n\n```bash\nphp artisan exceptionemail:test\n```\n\nThis command will throw a `Webmonks\\ExceptionEmail\\Exceptions\\DummyException`, and the package will capture and send it as an email. If everything is set up correctly, you should receive the test email.\n\n## Security\n\nIf you discover any security issues, please contact us directly via email at damku999@gmail.com, rather than opening an issue on GitHub.\n\n## Credits\n\n- [Darshan Baraiya](https://github.com/damku999)\n- [Squareboat](https://github.com/squareboat/sneaker)\n- [All Contributors](../../contributors)\n\n## About Webmonks\n\n[Webmonks](https://webmonks.in) is a product development startup based in Ahmedabad, India. You can explore all our open-source projects on [GitHub](https://github.com/damku999).\n\n## License\n\nThis package is open-sourced software licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamku999%2Fexcptionemail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamku999%2Fexcptionemail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamku999%2Fexcptionemail/lists"}