定制 rzl-app/laravel-toaster 二次开发

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

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

rzl-app/laravel-toaster

Composer 安装命令:

composer require rzl-app/laravel-toaster

包简介

A clean, powerful Laravel Toaster to generate session flash & props arrays — perfect for Blade, Vue, React, Inertia, Livewire, or plain APIs.

README 文档

README

    __        __              _                  _______
    \ \      / /__  _ __ ___  | |_ ___  ___ ___  \      \   ___ ___  ___
     \ \ /\ / / _ \| '__/ _ \ | __/ _ \/ __/ __| /   |   \ / __/ _ \/ __|
      \ V  V / (_) | | |  __/ | ||  __/\__ \__ \ /    |    \ (_|  __/\__ \
       \_/\_/ \___/|_|  \___|  \__\___||___/___/ \____|__  /\___\___||___/
                                                        \/          \/
                      🚀 Rzl App Laravel Toaster 🚀

A clean, powerful Laravel Session Flash & Props Toaster helper —
perfect for Blade, Vue, React, Inertia, Livewire, or plain API.
Built with ❤️ by @rzl-app.

Latest Version Downloads PHPStan PHP Laravel Illuminate Support Coverage

📚 Table of Contents

🛠 Requirements

Laravel Framework & illuminate/support PHP Package Version
^9.x | ^10.x | ^11.x | ^12.x ^8.2 v1.1.x
^9.x | ^10.x | ^11.x ^8.1 v1.0.x

⚙️ Installation

composer require rzl-app/laravel-toaster

Publish config

php artisan vendor:publish --tag="RzlLaravelToaster"

Will create config/rzl-laravel-toaster.php:

return [
  /*
  |--------------------------------------------------------------------------
  | Session Flash Name for Toaster
  |--------------------------------------------------------------------------
  |
  | This defines the session key name used to flash the toaster data.
  | It will be retrieved on the frontend after a redirect or page reload.
  |
  | Note: The Value must be string and not empty or only space or as blank
  |       value, if invalid value will return fallback as "toast".
  |
  | Default: 'toast'
  |
  | Example:
  | session()->flash('toast', [...]);
  |
  */
  'session_name'  => "toast",

  /*
  |--------------------------------------------------------------------------
  | Settings Toaster Options As Session Flash or Only Return As Props Array.
  |--------------------------------------------------------------------------
  |
  | Toaster Mode: Flash Session or Return as Props Array
  | Return Format:
  |
  |  * false: `Session` -> `session()->flash("toast", [
  |               $title, $message, $type, $durationClose
  |           ]);`
  |
  |  * true: Props json output or array.
  |
  */
  'as_prop'       => false,
];

🚀 Usage

✅ Basic flash

toaster('Profile saved!');

🚀 With type & timeout

toaster('Unauthorized action!', 'error', 5000);
toaster('Heads up!', 'warning', 0); // No auto close

🪄 Shortcuts

toasterSuccess('Data saved!');
toasterError('Something wrong...');
toasterInfo('Heads up!');
toasterWarning('Careful!');

🔥 Props for API / SPA

return [
    'toast' => toasterAsProps('Welcome back!', 'info')
];

or shortcuts:

return response()->json([
    'toast' => toasterErrorAsProps('Invalid data!')
]);

🖥 Blade Example

@if(session('toast'))
  <script>
    window.toast = @json(session('toast'));
    console.log('Toast:', window.toast);
  </script>
@endif

🚀 JSON output

{
  "title": "success_1725459999",
  "message": "Profile updated",
  "type": "success",
  "durationClose": 2000,
  "timeGenerate": 1725459999
}

💡 Tips & Best Practice

✅ Use session for simple Laravel + Blade / Livewire.
✅ Use props for Inertia, SPA, or pure API.
✅ Set as_prop true in config to force always JSON array.

❤️ Sponsor this package

Help support development:

👉 Become a sponsor

📝 Changelog

See CHANGELOG.

🤝 Contributing

See CONTRIBUTING.

🛡 Security

Please report issues to rizalvindwiky@gmail.com.

🙌 Credits

📜 License

The MIT License (MIT). Please see License File for more information.

Enjoy using rzl-app/laravel-toaster?
Star this repo ⭐ and share it with other Laravel developers!

rzl-app/laravel-toaster 适用场景与选型建议

rzl-app/laravel-toaster 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 07 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 rzl-app/laravel-toaster 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-07