{"id":22916663,"url":"https://github.com/synergitech/laravel-alert","last_synced_at":"2025-05-12T17:04:27.883Z","repository":{"id":34839282,"uuid":"184286485","full_name":"SynergiTech/laravel-alert","owner":"SynergiTech","description":"Construct custom alerts for your Laravel app","archived":false,"fork":false,"pushed_at":"2025-02-24T14:36:03.000Z","size":63,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-12T17:04:14.167Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/SynergiTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-30T15:23:58.000Z","updated_at":"2025-02-24T14:35:03.000Z","dependencies_parsed_at":"2023-12-01T13:45:02.583Z","dependency_job_id":"adc18aef-afe9-4fef-a702-6b2d88caf24b","html_url":"https://github.com/SynergiTech/laravel-alert","commit_stats":{"total_commits":37,"total_committers":4,"mean_commits":9.25,"dds":0.2432432432432432,"last_synced_commit":"863b5113763c0168f701f042ee6bb84f3c62b06d"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SynergiTech%2Flaravel-alert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SynergiTech%2Flaravel-alert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SynergiTech%2Flaravel-alert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SynergiTech%2Flaravel-alert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SynergiTech","download_url":"https://codeload.github.com/SynergiTech/laravel-alert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253784908,"owners_count":21963899,"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":[],"created_at":"2024-12-14T06:14:11.711Z","updated_at":"2025-05-12T17:04:27.853Z","avatar_url":"https://github.com/SynergiTech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Alert\n\n[![Tests](https://github.com/SynergiTech/laravel-alert/actions/workflows/test.yml/badge.svg)](https://github.com/SynergiTech/laravel-alert/actions/workflows/test.yml)\n\nInspired by [Easy Sweet Alert Messages for Laravel](https://github.com/uxweb/sweet-alert), this package provides a way of constructing alerts for the UI of your app.\n\nOut of the box, this package supports [SweetAlert2](https://sweetalert2.github.io/) but its output can be tailored to support other plugins if you wish to create toasts alongside your SweetAlerts for example.\n\n## Installation\n\n```\ncomposer require synergitech/laravel-alert\n```\n\nLaravel should be able to automatically detect the package and include it.\n\nYou should also make sure you have appropriately installed SweetAlert2 and/or any other notification package into your apps UI.\n\n## Quick Start\n\nYou can use the facade or the helper function in your app to generate alerts containing a simple title, text, and type element.\n\n```php\nuse Alert;\n\n...\n\nAlert::message('Message', 'Optional Title');\nAlert::info('Info Message', 'Optional Title');\nAlert::success('Success Message', 'Optional Title');\nAlert::error('Error Message', 'Optional Title');\nAlert::warning('Warning Message', 'Optional Title');\n```\n\n```php\nalert()-\u003emessage('Message', 'Optional Title');\nalert()-\u003einfo('Info Message', 'Optional Title');\nalert()-\u003esuccess('Success Message', 'Optional Title');\nalert()-\u003eerror('Error Message', 'Optional Title');\nalert()-\u003ewarning('Warning Message', 'Optional Title');\n```\n\nTo actually display the alert you will need to include a short snippet of code in your main view file. This package only outputs complete JSON objects into your session.\n\n**Please note** this data is _put_ into your session so you have to _pull_ it to clear it out of the session. This allows you to not lose alerts from background ajax calls.\n\n### Blade\n```php\n@if (Session::has('alert.sweetalert'))\n    \u003cscript\u003e\n        Swal.fire({!! Session::pull('alert.sweetalert') !!});\n    \u003c/script\u003e\n@endif\n```\n\n### Twig\n```twig\n{% if session_has('alert.sweetalert') %}\n    \u003cscript\u003e\n        Swal.fire({{ session_pull('alert.sweetalert')|raw }});\n    \u003c/script\u003e\n{% endif %}\n```\n\n## Advanced Usage\n\nThis package provides a builder-like syntax allowing you to customise the alert further. The following examples provide identical output.\n\n```php\nalert()-\u003ewarning('You need to complete extra fields', 'Unable to submit');\n\n\\Alert::warning('You need to complete extra fields')\n    -\u003etitle('Unable to submit');\n\nalert()-\u003etype('warning')\n    -\u003emessage('You need to complete extra fields')\n    -\u003etitle('Unable to submit');\n```\n\nYou can customise the fields available by publishing the config to your application. Read the config file for more details.\n\n```sh\nphp artisan vendor:publish --provider=\"SynergiTech\\Alert\\ServiceProvider\"\n```\n\n### Multiple Output Types\n\nIf you specify a second output, for example to create a toast option, this library will always add **both** to the session _unless_ you ask for a specific type (v2 only).\n\n```php\n// in your controller\n\nalert()-\u003eoutput('toast')-\u003einfo('Please check your settings.');\n\n// OR\n\nalert()-\u003eas('toast')-\u003einfo('Please check your settings.');\n```\n\nExample config:\n\n```php\n// config/alert.php\n\n'output' =\u003e [\n    'sweetalert' =\u003e [\n        'title' =\u003e 'title',\n        'text' =\u003e 'text',\n        'icon' =\u003e 'type',\n    ],\n    'toast' =\u003e [\n        'text' =\u003e 'text',\n        'icon' =\u003e 'type',\n    ],\n],\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynergitech%2Flaravel-alert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynergitech%2Flaravel-alert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynergitech%2Flaravel-alert/lists"}