最近在做服务器通知的时候,发现邮件,短信什么的都需要钱,但是自己需要的服务要求也不高,遂找到了server酱做代替,真的是一个非常好用简单易用的的推送工具,你可以用来做,
- 服务器运维通知
- 评论通知,当有人评论你博客时候可以做通知工具
- 网站留言本,直接推送到你的微信
同时,我也将它laravel化了
可以看这里sevenshi/serverchan
A Easy Laravel Package for ServerChan
See Server酱
Quick Start Guide
Create a Laravel 5.5 project:
composer create-project laravel/laravel myproject dev-develop
cd myproject
Add dependency:
composer require sevenshi/serverchan
Copy configuration:
php artisan vendor:publish
set the SCKEY you get from the serverchan on the .env
SCKEY=SCU17044T7eafa406fxxxxxxxxxx
Now you are ready to use the Seven Facade, e.g. open routes/web.php:
- send message to yourself
<?php
Route::get('seven',function (){
Seven::setTitle('hi')->setMessage('hello world')->push();
});
- send message to who subscribe your channel
the channel comes from the PushBear,and channel key comes from the channel you create
<?php
Route::get('seven',function (){
Seven::setTitle('hi')->setMessage('hello every body')->setChannel('4794-e28b9dae54e86365773xxx')->pushbear();
});
- response
if the request is ok,it will response these data below:
push:
- success {"errno":0,"errmsg":"success","dataset":"done"}
pushbear:
- {"code":0,"message":"","data":"1\u6761\u6d88\u606f\u5df2\u6210\u529f\u63a8\u9001\u5230\u53d1\u9001\u961f\u5217","created":"2018-07-18 14:43:05"}