Download the PHP package sangamkatwal/sangam-toastr without Composer
On this page you can find all versions of the php package sangamkatwal/sangam-toastr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sangamkatwal/sangam-toastr
More information about sangamkatwal/sangam-toastr
Files in sangamkatwal/sangam-toastr
Package sangam-toastr
Short Description A simple Laravel package for Toastr notifications with support for session flash messages and AJAX responses. Handles success, error, warning, and info notifications seamlessly.
License MIT
Homepage https://github.com/143Sangam143/sangam-toastr
Informations about the package sangam-toastr
π Sangam Toastr
A simple and elegant Laravel package for Toastr notifications that works seamlessly with both session flash messages and AJAX responses.
Note: This is my first Laravel package! π If anything isn't clear, feel free to reach out via email or create an issue.
β¨ Features
- π Dual Support: Works with both session redirects and AJAX calls
- π¨ 4 Notification Types: Success, Error, Warning, Info
- π Zero Configuration: Works out of the box
- π± Responsive: Mobile-friendly notifications
- π§ Laravel Integration: Auto-discovery support
- π‘ Simple API: Consistent key-value pair format
π¦ Installation
π§ Setup
1. Publish Assets
2. Include Assets in Layout
Add to your layouts/app.blade.php
(inside <head>
):
3. Include Notifications
Add before closing </body>
tag in your layout:
π Usage
Session Flash Messages (Redirects)
AJAX Responses
Frontend AJAX Implementation
Mixed Request Types (AJAX + Regular)
Perfect for controllers that handle both AJAX and regular requests:
π Notification Types
Type | Usage |
---|---|
success |
β Success operations |
error |
β Error messages |
warning |
β οΈ Warning alerts |
info |
βΉοΈ Information notices |
βοΈ Requirements
- PHP: >= 8.0
- Laravel: 8.x, 9.x, 10.x, 11.x
- jQuery: 3.7.1 (recommended, not tested with other versions)
π Validation Examples
See ValidationExamples.md for detailed examples with Laravel validation.
π€ Contributing
This is my first package, so contributions and suggestions are very welcome!
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
π License
This package is open-sourced under the MIT license.
π¨βπ» Author
Sangam Katwal - [email protected]
βοΈ Note By Author
This README was written with the help of AI based on my inputs. If you notice anything unclear or incorrect, feel free to reach out to me via email.
The Toastr CSS and JS used in this package are from the original Toastr.js v2.1.3. This package is completely free and open-source.
The main reason I built this package is because I often had to dig through old projects just to copy my custom Toastr response logic. By turning it into a reusable package, Iβve made it easier for myselfβand Iβm sharing it publicly in case it simplifies things for others too.
π¨βπ» Note For Developers
While this package encourages a simple and consistent response format (one notification type + one message), it does not restrict Laravelβs default flexibility. You can still attach additional values to your responses, whether for session flashes or AJAX.
For example:
// Redirect response with extra data
return redirect()->back()->with([
'success' => true,
'message' => 'Data saved successfully!',
'status' => 200,
'extra' => 'Any other value'
]);
// AJAX response with extra fields
return response()->json([
'success' => true,
'message' => 'Data saved successfully!',
'status' => 200,
'data' => ['id' => 123, 'name' => 'Sample']
]);
So, you still get all the power of Laravel responses while enjoying clean, consistent Toastr notifications. π
---
β **Star this repo if it helped you!**