承接 luizfabianonogueira/sse-notify 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

luizfabianonogueira/sse-notify

Composer 安装命令:

composer require luizfabianonogueira/sse-notify

包简介

Poderosa ferramenta para notificar o usuário de eventos importantes em tempo real

README 文档

README

Laravel Logo

SSE-NOTIFY

Latest Stable Version Total Downloads Latest Unstable Version License

Description

If you’re developing with Laravel and looking for an effective way to interact with your users in real time, your solution is here! With [Sse-Notify], you can:

💡 Real-Time Notifications

Leverage the power of SSE (Server-Sent Events) to effortlessly send notifications from the server to the client, ensuring a smooth, real-time user experience!

🔔 Multiple Notification Options

Choose from various styles and modes of notification:

  • Traditional JavaScript Alerts
  • Modern notifications with Bootstrap Notify
  • Sleek messages with Bootstrap Toast
  • Visually stunning pop-ups with SweetAlert2
  • HTML and JavaScript Injection for dynamic content

🎯 Infinite Flexibility

With support for dynamic HTML and JavaScript injection, the possibilities are literally endless! Create unique and personalized interactions tailored to your project and user needs.

⚙️ Easy Integration

[Sse-Notify] is simple to integrate with your Laravel project. Just install the package and start harnessing the power of SSE communication to elevate your user notifications.

👉 Ready to transform how you interact with your users?

Try [Sse-Notify] and discover how easy it is to take your notifications to the next level!

Requirements

PHP 8.2 or higher
Laravel 10.0 or higher
User table with id uuid column
Active authentication system
Active uuid extension in database

Installation

composer require luizfabianonogueira/sse-notify

After installation, register the service provider.\

In bootstrap/providers.php.

<?php
return [
    // other providers...
    LuizFabianoNogueira\SseNotify\SseServiceProvider::class, 
];

After that you must publish the migration and js file.

php artisan vendor:publish --tag=sse-notify-migrations
php artisan vendor:publish --tag=sse-notify-assets

Attention: the sse.js file will be exported to public/assets/js/sse.js.
If you use Vite or similar tools, configure js correctly to be loaded.

Execute the migration to create the table that will store the notifications.

php artisan migrate

Now we need to configure the communication channel.

In the view you chose to have the channel open, insert the following code.

    @if(Auth::check())
        <!-- Include the sse.js file -->
        <script src="{{ asset('assets/js/sse.js') }}"></script>
        <script>
            <!-- Call the SseConnect function passing the route to the connection -->
            SseConnect('{{ route('sse.connect', ['userId' => Auth::user()->id]) }}');
        </script>
    @endif

Testing

To run a user test, simply access the following url

yourdomain.com/sse/generateFakeData/{userId}

Usage Example

..::|| javaScript alert() ||::..

    $sseMessageAlert = new SseEventMessageAlert([
        'message' => 'Notify Alert!', //string
        'userId' => {userId}, //uuid
    ]);
    $sseMessageAlert->save();

..::|| SweetAlert2 ||::..

$data = [
    'title' => 'Notify title Sweet!', //string
    'message' => 'Notify message Sweet!', //string
    'type' => SseEnumStyle::STYLE_SUCCESS, //Enum types: STYLE_SUCCESS, STYLE_ERROR, STYLE_WARNING, STYLE_INFO
    'id' => time(),// int id unique
    'confirm' => false, // if true show confirm button
    'userId' => $this->userId //uuid - user to be notified
];
(new SseEventMessageSweet($data))->save();

..::|| Bootstrap Notify ||::..

$data = [
    'title' => 'Notify title notify!', //string
    'message' => 'Notify message notify!', //string
    'type' => SseEnumStyle::STYLE_SUCCESS, //Enum types: STYLE_SUCCESS, STYLE_ERROR, STYLE_WARNING, STYLE_INFO
    'id' => time(), // int id unique
    'autoClose' => true, // if true auto close
    'userId' => $this->userId //uuid - user to be notified
];
(new SseEventMessageNotify($data))->save();

..::|| Bootstrap TOAST ||::..

$data = [
    'title' => 'Notify title toast!', //string
    'message' => 'Notify message toast!', //string   
    'type' => SseEnumStyle::STYLE_SUCCESS, //Enum types: STYLE_SUCCESS, STYLE_ERROR, STYLE_WARNING, STYLE_INFO
    'id' => time(), // int id unique
    'autoClose' => true, // if true auto close
    'userId' => $this->userId, //uuid - user to be notified
    'imgURL' => '/android-chrome-192x192.png', //string - image url [optional]
    'linkURL' => 'https://www.google.com', //string - link url [optional]
    'linkText' => 'Google' //string - link text [optional]
];
(new SseEventMessageToast($data))->save();

..::|| INJECTION HTML ||::..

(new SseEventInjectHtml([
    'html' => '<div class="alert alert-success">Notify message!</div>', //string - html to be injected 
    'target' => 'boxTestes', //string - target id to inject
    'userId' => $this->userId //uuid - user to be notified
]))->save();

..::|| INJECTION SCRIPT ||::..

(new SseEventInjectScript([
    'script' => 'console.log("Notify message! - ' . $i . '")', //string - script to be injected
    'userId' => $this->userId //uuid - user to be notified
]))->save();

After saving, the system sends the notification to the target user.
Each notification has a 3 seconds interval between them.
If you don't have notifications, the next check is in 10 seconds.

License: LGPL-3.0-or-later

Contact & Support

LinkedIn WhatsApp GitHub Packagist

📞 Phone: +5548991779088
✉️ Email: luizfabianonogueira@gmail.com

Support My Work

If you enjoyed this project and would like to support my work, any donation via Pix is greatly appreciated!
Feel free to donate using one of the following Pix keys:

💳 Email Pix Key: luizfabianonogueira@gmail.com
📱 Phone Pix Key: 48991779088

Thank you for your support!

luizfabianonogueira/sse-notify 适用场景与选型建议

luizfabianonogueira/sse-notify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 luizfabianonogueira/sse-notify 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2024-09-12