{"id":15016919,"url":"https://github.com/bastinald/laravel-livewire-toasts","last_synced_at":"2025-04-12T10:42:13.976Z","repository":{"id":43861145,"uuid":"385772417","full_name":"bastinald/laravel-livewire-toasts","owner":"bastinald","description":"Dynamic Laravel Livewire Bootstrap toasts.","archived":false,"fork":false,"pushed_at":"2022-02-15T16:55:19.000Z","size":8,"stargazers_count":16,"open_issues_count":1,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T09:46:45.097Z","etag":null,"topics":["bootstrap","bootstrap-toasts","laravel","laravel-livewire","livewire","php","toasts"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bastinald.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-14T00:49:18.000Z","updated_at":"2024-01-19T17:31:33.000Z","dependencies_parsed_at":"2022-09-06T07:20:49.765Z","dependency_job_id":null,"html_url":"https://github.com/bastinald/laravel-livewire-toasts","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-toasts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-toasts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-toasts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bastinald%2Flaravel-livewire-toasts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bastinald","download_url":"https://codeload.github.com/bastinald/laravel-livewire-toasts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557144,"owners_count":21124156,"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":["bootstrap","bootstrap-toasts","laravel","laravel-livewire","livewire","php","toasts"],"created_at":"2024-09-24T19:49:34.055Z","updated_at":"2025-04-12T10:42:13.947Z","avatar_url":"https://github.com/bastinald.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Livewire Toasts\n\nThis package allows you to dynamically show Bootstrap toasts via Laravel Livewire components.\n\n## Documentation\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Showing Toasts](#showing-toasts)\n    - [Emitting Events](#emitting-events)\n- [Publishing Assets](#publishing-assets)\n    - [Custom Config](#custom-config)\n    - [Custom View](#custom-view)\n\n## Requirements\n\n- Bootstrap 5 must be installed via webpack first\n\n## Installation\n\nRequire the package:\n\n```console\ncomposer require bastinald/laravel-livewire-toasts\n```\n\nAdd the `livewire:toasts` component to your app layout view:\n\n```html\n\u003clivewire:toasts/\u003e\n\u003clivewire:scripts/\u003e\n\u003cscript src=\"{{ asset('js/app.js') }}\"\u003e\u003c/script\u003e\n```\n\nRequire `../../vendor/bastinald/laravel-livewire-toasts/resources/js/toasts` in your app javascript file:\n\n```javascript\nrequire('@popperjs/core');\nrequire('bootstrap');\nrequire('../../vendor/bastinald/laravel-livewire-toasts/resources/js/toasts');\n```\n\n## Usage\n\n### Showing Toasts\n\nShow a toast by emitting the `showToast` event with the color \u0026 message:\n\n```php\npublic function save()\n{\n    $this-\u003evalidate();\n\n    $this-\u003euser-\u003eupdate([\n        'name' =\u003e $this-\u003ename,\n        'email' =\u003e $this-\u003eemail,\n    ]);\n\n    $this-\u003eemit('showToast', 'success', __('User updated!'));\n}\n```\n\nThe color should be a Bootstrap color name e.g. `success`, `danger`, `info`.\n\n### Emitting Events\n\nYou can emit events inside your views:\n\n```html\n\u003cbutton type=\"button\" wire:click=\"$emit('showToast', 'danger', 'Closing!')\"\u003e\n    {{ __('Close') }}\n\u003c/button\u003e\n```\n\nOr inside your components, just like any normal Livewire event:\n\n```php\npublic function save()\n{\n    $this-\u003evalidate();\n\n    // save the record\n\n    $this-\u003eemit('showToast', 'info', __('Record saved!'));\n}\n```\n\n## Publishing Assets\n\n### Custom Config\n\nCustomize the toasts configuration by publishing the config file:\n\n```console\nphp artisan vendor:publish --tag=laravel-livewire-toasts:config\n```\n\nNow you can easily change things like the hide delay and error message.\n\n### Custom View\n\nUse your own toasts view by publishing the view file:\n\n```console\nphp artisan vendor:publish --tag=laravel-livewire-toasts:views\n```\n\nNow edit the view file inside `resources/views/vendor/laravel-livewire-toasts`. The package will use this view to render the component.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastinald%2Flaravel-livewire-toasts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbastinald%2Flaravel-livewire-toasts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastinald%2Flaravel-livewire-toasts/lists"}