{"id":37003848,"url":"https://github.com/zunnu/cake-toastr","last_synced_at":"2026-01-14T00:35:34.805Z","repository":{"id":251782494,"uuid":"838460877","full_name":"zunnu/cake-toastr","owner":"zunnu","description":"A CakePHP 5 package for integrating Toastr notifications into your application. Initially created for personal use, this package provides a simple way to display customizable Toastr messages in your CakePHP 5 app.","archived":false,"fork":false,"pushed_at":"2024-08-05T18:56:23.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-01T19:26:38.615Z","etag":null,"topics":["cakephp","cakephp-plugin","flash-messages","notifications","php","toastr"],"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/zunnu.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":"2024-08-05T17:27:27.000Z","updated_at":"2024-08-05T18:58:03.000Z","dependencies_parsed_at":"2024-08-05T19:24:02.927Z","dependency_job_id":null,"html_url":"https://github.com/zunnu/cake-toastr","commit_stats":null,"previous_names":["zunnu/cake-toastr"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zunnu/cake-toastr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fcake-toastr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fcake-toastr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fcake-toastr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fcake-toastr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zunnu","download_url":"https://codeload.github.com/zunnu/cake-toastr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zunnu%2Fcake-toastr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cakephp","cakephp-plugin","flash-messages","notifications","php","toastr"],"created_at":"2026-01-14T00:35:34.082Z","updated_at":"2026-01-14T00:35:34.786Z","avatar_url":"https://github.com/zunnu.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cake-toastr\n\nThis package was created primarily for personal use. It allows you to easily integrate Toastr messages into your CakePHP application\n\n## Installing Using [Composer][composer]\n\n`cd` to the root of your app folder (where the `composer.json` file is) and run the following command:\n\n```\ncomposer require zunnu/cake-toastr\n```\nThen load the plugin by using CakePHP's console:\n\n```\n./bin/cake plugin load CakeToastr\n```\n\nNote the flash component does not need to be loaded but you need to have flash render in your layout.\n```php\n\u003c?= $this-\u003eFlash-\u003erender() ?\u003e\n```\n\n## Usage\n\n### Loading the Component\nLoad the component you will need to modify your `src/Controller/AppController.php` and load the toastr component in the `initialize()` function\n```php\n$this-\u003eFlash = $this-\u003eloadComponent('CakeToastr.Toastr', ['alias' =\u003e 'Flash']);\n```\n\n### Loading the Helper\nSure, you could load the view helper anywhere you like—like in a random controller or buried deep inside a view. But if you actually want things to work smoothly, and, you know, avoid a headache, just load it in the layout where it belongs. Because who doesn't love clean, maintainable code, right?\n```php\n$this-\u003eloadHelper('CakeToastr.Toastr', ['progressBar' =\u003e true]);\n```\nSee? Super simple. And if you're feeling extra fancy and want to tweak the options, go ahead and generate them from [this magical place](https://codeseven.github.io/toastr/demo.html).\n\n### Using Flash Messages\n\nFrom a controller, you can call it like a normal flash message:\n\n```php\n$this-\u003eFlash-\u003ewarning('This is a custom success message');\n```\n\nThis simple setup allows you to start using Toastr notifications with default settings. If you'd like to customize the behavior, you can pass additional options.\n\n### Customizing Toastr Notifications\n\n#### Using Callbacks\n\nYou can customize the behavior of Toastr notifications using JavaScript callbacks such as `onShown`, `onShow`, `onHide`, and `onHidden`. For example, if you want to execute custom JavaScript when a toast is fully displayed, you can use the `onShown` callback.\n\nHere's how to use the `onShown` callback:\n\n```php\n$this-\u003eloadHelper('CakeToastr.Toastr', [\n    'positionClass' =\u003e 'toast-bottom-center',\n    'callbacks' =\u003e [\n        'onShown' =\u003e 'function() {\n            console.log(\"Toastr notification displayed\");\n        }'\n    ]\n]);\n```\n\nThis setup logs a message to the console when the toast is shown.\n\n#### Injecting Custom CSS\n\nYou can also inject custom CSS to style your Toastr notifications. For instance, if you want to adjust the minimum width and position of your toast messages, you can pass custom CSS as follows:\n\n```php\n$this-\u003eloadHelper('CakeToastr.Toastr', [\n    'positionClass' =\u003e 'toast-bottom-center',\n    'customCss' =\u003e '\n        .toast-bottom-center {\n            bottom: 8%;\n        }\n        .toast-bottom-center .toast {\n            min-width: 600px;\n        }\n    ',\n    'callbacks' =\u003e [\n        'onShown' =\u003e 'function() {\n            console.log(\"Custom styles applied and Toastr notification shown\");\n        }'\n    ]\n]);\n```\n\nThis will ensure that the toast messages have a minimum width of 600px and are positioned 8% from the bottom of the screen.\n\n### Putting It All Together\n\nCombine callbacks and custom CSS for a fully customized experience:\n\n```php\n$this-\u003eloadHelper('CakeToastr.Toastr', [\n    'positionClass' =\u003e 'toast-bottom-center',\n    'customCss' =\u003e '\n        .toast-bottom-center {\n            bottom: 8%;\n        }\n        .toast-bottom-center .toast {\n            min-width: 600px;\n        }\n    ',\n    'callbacks' =\u003e [\n        'onShown' =\u003e 'function() {\n            $(\".toast-bottom-center .toast\").css(\"background-color\", \"#333\");\n            console.log(\"Custom background color applied and Toastr notification shown\");\n        }'\n    ]\n]);\n```\n\nIn this example, the toast background color is dynamically changed to a custom color when the toast is shown.\n\n## License\n\nLicensed under [The MIT License][mit].\n\n[cakephp]:http://cakephp.org\n[composer]:http://getcomposer.org\n[mit]:http://www.opensource.org/licenses/mit-license.php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzunnu%2Fcake-toastr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzunnu%2Fcake-toastr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzunnu%2Fcake-toastr/lists"}