laravelhungary/announcement
Composer 安装命令:
composer require laravelhungary/announcement
包简介
A simple way of announcements with Laravel
README 文档
README
Laravel Announcement
A package that simplifies the management of site-wide announcements. With "Laravel Announcement" you can display auto-expiring announcements.
Installation
1- composer require laravelhungary/announcement
- plz note that the package use
predis/predisfor all of its operation.
2- Add the followings to config/app.php
'providers' => [ ... LaravelHungary\Announcement\PackageServiceProvider::class, ], 'aliases' => [ ... 'Announce' => LaravelHungary\Announcement\Facades\Announce::class, ]
3- run php artisan vendor:publish and you will get
/config/announcement.php /views/vendor/announcement/alert.blade.php /Events/NewAnnouncement.php /components/Announcement-bootstrap.vue /components/Announcement-sweetalert.vue
4- That's it.
if you need to broadcast the announcements through something like web-sockets please check Event Broadcasting
Usage
Normal
Create Announcement
Announce::create($title, $message, $type, $ttl);
Params
titlea short message.
For example: Breaking news!
messageA bit longer message.
For example: Our servers are under a DDoS attack. We are trying hard to mitigate it.
typeType of the announcement.
For example: success,info,danger,warning (or anything you would like to use) , Default is: info
ttlWhen should the announcement expire. [Time to live] in seconds.
Default is: 60 seconds
Display of Announcements
put {!! Announce::display() !!} anywhere you want your announcement to be visible.
===
Broadcasting
Create Announcement
Announce::broadcast($title, $message, $type, $ttl, $transition, $channel_name);
Params
-
title,message,type,ttlsame as the normal announcement -
transitionwhat is animation type you want.
For example: fade , bounce, etc... Check Vue Transition , Default is: fade
channel_namechange it to override the config value "dont forget to also change it in the component file"
Default is: public-announcement-channel
Display of Announcements
- note that the package doesnt care what driver you use
pusherorsocket.io, it will just work 🍺. - we also use VueJs 2, but if you want to use something else then ignore the below and you are free to build your own.
1- put Vue.component('my-announcement', require('./components/Announcement-bootstrap.vue')); into your app.js file
2- put <my-announcement></my-announcement> anywhere you want this announcement to show up. For example: your layout.blade.php file
if you want to use something like
Animate.cssfollow Custom Transition Classes
Package Maintainers
Buy us a coffee :)
laravelhungary/announcement 适用场景与选型建议
laravelhungary/announcement 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 477 次下载、GitHub Stars 达 17, 最近一次更新时间为 2016 年 09 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「redis」 「laravel」 「Announcement」 「hocza」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 laravelhungary/announcement 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 laravelhungary/announcement 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 laravelhungary/announcement 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Microservice RPC through message queues.
The CodeIgniter Redis package
贝嘟分布式缓存扩展
Claroline announcement bundle
Redis distributed locks for laravel
Redis backed library for creating background jobs and processing them later.
统计信息
- 总下载量: 477
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-09