justinjunkes/laravel-notify
Composer 安装命令:
composer require justinjunkes/laravel-notify
包简介
Flexible flash notifications for Laravel
README 文档
README
Introduction
Laravel Notify is a package that lets you add custom notifications to your project. A diverse range of notification design is available.
Version Guidance
| Version | Laravel version | Status | Branch | Install |
|---|---|---|---|---|
| 1.x | 5.5, 5.6, 5.7, 6.0 | EOL | 1.0 | composer require mckenziearts/laravel-notify 1.* |
| 2.x | >= 7.0 | Latest | 2.0 | composer require mckenziearts/laravel-notify |
Android Version
If you need Android version please try this package Aesthetic Dialogs. Happy Coding 👨🏾💻
Installation
You can install the package using composer
$ composer require mckenziearts/laravel-notify
Then add the service provider to config/app.php. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.
'providers' => [ ... Mckenziearts\Notify\LaravelNotifyServiceProvider::class ... ];
You can publish the configuration file and assets by running:
$ php artisan vendor:publish --provider="Mckenziearts\Notify\LaravelNotifyServiceProvider"
Now that we have published a few new files to our application we need to reload them with the following command:
$ composer dump-autoload
Usage
- Add styles links with
@notifyCss - Add scripts links with
@notifyJs - use
notify()helper function inside your controller to set a toast notification for info, success, warning or error - Include notify partial to your master layout
@include('notify::components.notify')
If you are on Laravel 7 or greater, you can use the tag syntax.
<x:notify-messages />
Basic
Within your controllers, before you perform a redirect call the notify method with a message.
public function store() { notify()->success('Laravel Notify is awesome!'); return Redirect::home(); }
An complete example:
<!doctype html> <html> <head> <title>Laravel Notify</title> @notifyCss </head> <body> @include('notify::messages') // Laravel 7 or greater <x:notify-messages /> @notifyJs </body> </html>
Type of notifications
Laravel Notify actually display 5 types of notifications
toastnotification, (The default notification for Laravel Notify)
notify()->success('Welcome to Laravel Notify ⚡️') or notify()->success('Welcome to Laravel Notify ⚡️', 'My custom title')
connectifynotification, example of basic usage
connectify('success', 'Connection Found', 'Success Message Here')
drakify(😎) notification, displays an alert only
drakify('success') // for success alert or drakify('error') // for error alert
smilifynotification, displays a simple custom toast notification using the smiley (😊) emoticon
smilify('success', 'You are successfully reconnected')
emotifynotification, displays a simple custom toast notification using a vector emoticon
emotify('success', 'You are awesome, your data was successfully created')
Preset Notifications
If you have a specific notification that is used across multiple different places in your system, you can define it as a preset notification in your config file. This makes it easier to maintain commonly used notifications in one place. Read how to define preset messages in the Config section below.
As an example, to use a preset notification you have defined called 'common-notification', use the following:
notify()->preset('common-notification')
You can override any of the values that are set in the config if you need to. For example, this could be useful if you have a common notification across, but you want to change the icon in one particular place that it's used without having to manually write out a new notification.
To do this, simply pass in an array that has the key of the attribute that you want to override and the value you want to override it with.
As an example, we could override the 'title' of our 'common-notification' by using the following:
notify()->preset('common-notification', ['title' => 'This is the overridden title'])
Config
Config file are located at config/notify.php after publishing provider element.
Some awesome stuff. To active dark mode update the theme config, or add global variable NOTIFY_THEME on your .env file
'theme' => env('NOTIFY_THEME', 'dark'),
You can define preset notifications in the config file using the following structure:
'preset-messages' => [ 'user-updated' => [ 'message' => 'The user has been updated successfully.', 'type' => 'success', 'model' => 'connect', 'title' => 'User Updated', ], 'user-deleted' => [ 'message' => 'The user has been deleted successfully.', 'type' => 'success', 'model' => 'connect', 'title' => 'User Deleted', ], ],
The example above shows the config for two preset notifications: 'user-updated' and 'user-deleted'.
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
Donate ❤️
If you use and enjoy Laravel Notify you can encourage the author by
- Donating today!.
- Star the project ⭐.
Donors list:
- Charlie J - (10,00 $ USD) -
Donation made with love by Charlie from United Kingdom- 9 October 2020
License
license. Please see the license file for more information.
justinjunkes/laravel-notify 适用场景与选型建议
justinjunkes/laravel-notify 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 2.22k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「notification」 「laravel」 「laravel-notify」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 justinjunkes/laravel-notify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 justinjunkes/laravel-notify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 justinjunkes/laravel-notify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Flexible flash notifications for Laravel
This package makes it easy to send notifications via AfricasTalking with Laravel
Apple Push Notification & Feedback Provider
Throttle notifications on a per-channel basis
Extensible library for building notifications and sending them via different delivery channels.
Simple javascript toast notifications
统计信息
- 总下载量: 2.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-21