定制 ascsoftw/livewire-toast 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ascsoftw/livewire-toast

Composer 安装命令:

composer require ascsoftw/livewire-toast

包简介

Livewire Package to display Toast Notifications

README 文档

README

Livewire Package to display Toast Notification based on TALL Stack.

Requirements

Make sure that Livewire is installed properly on your project.

Make sure that TailwindCSS is installed properly on your project.

Make sure that AlpineJS is installed properly on your project.

Installation

You can install the Package using Composer

composer require ascsoftw/livewire-toast

Usage

Put Livewire-component @livewire('livewire-toast') anywhere into your app layout.

You can then call the Livewire Toast as below:

From Livewire Component

$this->emitTo('livewire-toast', 'show', 'Project Added Successfully'); //Will show Success Message
$this->emitTo('livewire-toast', 'showError', 'There was an Error!'); //Will show error. showError, showWarning, showInfo, showSuccess are supported
$this->emitTo('livewire-toast', 'show', ['type' => 'warning', 'message' => 'This is warning!']); //Can also pass type and message as array

Using Session Flash

session()->flash('livewire-toast', 'Project Added Successfully');
session()->flash('livewire-toast', ['type' => 'error', 'message' => 'There was an Error!']);

From Livewire View

$emitTo('livewire-toast', 'show', 'Project Added Successfully'); //Will show Success Message
$emitTo('livewire-toast', 'showError', 'There was an Error!'); //Will show error. showError, showWarning, showInfo, showSuccess are supported
$emitTo('livewire-toast', 'show', {'type' : 'warning', 'message' : 'This is warning!'}); //Can also pass type and message as object

From JS

Livewire.emitTo('livewire-toast', 'show', 'Project Added Successfully'); //Will show Success Message
Livewire.emitTo('livewire-toast', 'showError', 'There was an Error!'); //Will show error. showError, showWarning, showInfo, showSuccess are supported
Livewire.emitTo('livewire-toast', 'show', {'type' : 'warning', 'message' : 'This is warning!'}); //Can also pass type and message as object

Configurations

If you want to override the configurations, you must publish the assets using below command

php artisan vendor:publish --tag=config

This will publish the configuration file at config/livewire-toast.php. You can override any configurations.

Name Type Default Description Options
type String success Notification Type success, warning, error, info
position String bottom-right Part of the screen where notifications will pop out bottom-right, bottom-left, top-right, top-left
duration Number 3000 Time (in ms) to keep the notification on screen (if negative - notification will stay forever or until clicked)
showIcon Boolean true Whether to show icon next to message.
hideOnClick Boolean true Close notification when clicked
color.bg.success String green Color for Success Notification. Must be available in TailwindCss
color.bg.warning String yellow Color for Warning Notification. Must be available in TailwindCss
color.bg.info String blue Color for Info Notification. Must be available in TailwindCss
color.bg.error String red Color for Error Notification. Must be available in TailwindCss
text_color String white Text Color used by TailwindCss class. If using color other than white or black, provide full color like red-300.
transition Boolean true Whether to use Transition to hide/show Notification
transition_type String appear_from_above Transition Type appear_from_below, appear_from_above, appear_from_left, appear_from_right, zoom_in, rotate

You can also publish the View using below command

php artisan vendor:publish --tag=views

This will publish the Views in resources/views/vendor/livewire-toast directory which you can then customize.

Troubleshooting

Your messages don't get styles while using TailwindCss? Please publish your view. Therefore Laravel Mix compiler will find package related views and will purge CSS accordingly.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Credits

License

MIT

ascsoftw/livewire-toast 适用场景与选型建议

ascsoftw/livewire-toast 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 545.76k 次下载、GitHub Stars 达 48, 最近一次更新时间为 2021 年 05 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「notifications」 「laravel」 「toast」 「livewire」 「LivewireToast」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ascsoftw/livewire-toast 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ascsoftw/livewire-toast 我们能提供哪些服务?
定制开发 / 二次开发

基于 ascsoftw/livewire-toast 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 545.76k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 48
  • 点击次数: 29
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 48
  • Watchers: 1
  • Forks: 15
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-23