sentix/alert
Composer 安装命令:
composer require sentix/alert
包简介
Laravel Alert Notification Plugin with configurable positions and colors
README 文档
README
A comprehensive Laravel plugin for displaying beautiful, configurable alert notifications with support for multiple positions, colors, and animations.
Features
- Configurable Positions: Top, bottom, center with custom offsets
- Multiple Color Themes: Success, error, warning, info, dark, light
- Laravel Integration: Blade directives, facades, helper functions
- Auto-dismiss: Configurable timeout with hover pause
- Responsive Design: Mobile-friendly notifications
- Session Integration: Automatic display of Laravel session messages
- Validation Errors: Built-in support for Laravel validation errors
Installation
website: https://sentixtech.github.io/pluginAlert
- Install via Composer:
composer require sentix/alert
- Install NPM Dependencies:
npm install
2.3. Add Provider:
Alert\AlertNotificationServiceProvider::class
- Publish Configuration:
php artisan vendor:publish --provider="Alert\AlertNotificationServiceProvider" --tag="config"
- Publish Assets:
php artisan vendor:publish --provider="Alert\AlertNotificationServiceProvider" --tag="assets"
Usage
Blade Directives
Add these directives to your master layout file:
<!DOCTYPE html> <html> <head> <title>Your App</title> @alertStyles </head> <body> <!-- Your content --> @alertNotifications @alertScripts </body> </html>
Helper Functions
// In your controllers session()->flash('success','Welcome to sentixtech.com'); session()->flash('error','Welcome to sentixtech.com'); session()->flash('info','Welcome to sentixtech.com'); session()->flash('warning','Welcome to sentixtech.com');
JavaScript Usage
// Show alerts programmatically notify("success", "Dynamic success message"); notify("error", "Dynamic error message", "Custom Title"); // Legacy support notify(false, "Success message"); // false = success notify(true, "Error message"); // true = error
Configuration
Edit config/alert-notification.php to customize:
Position Settings
'position' => [ 'vertical' => 'bottom', // top, bottom, center 'horizontal' => 'right', // left, right, center 'offset' => [ 'top' => '20px', 'bottom' => '20px', 'left' => '20px', 'right' => '20px', ] ],
Color Customization
'colors' => [ 'success' => [ 'background' => '#28a745', 'text' => '#ffffff', 'border' => '#1e7e34' ], // ... other colors ],
Animation Settings
'animation' => [ 'duration' => '0.35s', 'easing' => 'cubic-bezier(0.21, 1.02, 0.73, 1)', 'auto_dismiss' => true, 'dismiss_timeout' => 5000, // milliseconds ],
Available Alert Types
success- Green success messageserror- Red error messageswarning- Yellow warning messagesinfo- Blue informational messagesdark- Dark themed messageslight- Light themed messages
Laravel Session Integration
The plugin automatically displays Laravel session messages:
// In your controller return redirect()->back()->with('success', 'Data saved successfully!'); return redirect()->back()->with('error', 'Validation failed!'); return redirect()->back()->with('warning', 'Please review your input!'); return redirect()->back()->with('info', 'Additional information...');
Validation Errors
Validation errors are automatically displayed:
// In your controller $request->validate([ 'email' => 'required|email', 'name' => 'required|min:3' ]); // Validation errors will automatically show as notifications
Advanced Configuration
Custom Icons
You can customize icons in the configuration file by modifying the icons array.
Progress Bar
Enable progress bar for auto-dismiss:
'enable_progress_bar' => true, 'progress_bar_height' => '4px',
Sound Notifications
'Coming Soon!!'
Browser Support
- Chrome 60+
- Firefox 55+
- Safari 12+
- Edge 79+
License
MIT License
sentix/alert 适用场景与选型建议
sentix/alert 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sentix/alert 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sentix/alert 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-20