tackk/shover

轻量级的PHP接口,用于Pusher API

v1.1.2 2015-05-14 17:43 UTC

This package is not auto-updated.

Last update: 2024-09-14 13:35:48 UTC


README

轻量级的PHP接口,用于Pusher API

安装

Composer

"tackk/shover": "1.1.*"

传输

所有传输必须扩展Tackk\Shover\Transport\AbstractTransport

默认包含两个(2)传输

  • Tackk\Shover\Transport\Curl - 使用PHP Curl扩展。
  • Tackk\Shover\Transport\Guzzle - 使用Guzzle

Curl

<?php
use Tackk\Shover\Credentials;
use Tackk\Shover\Transport\Curl;
use Tackk\Shover\Client;

require 'vendor/autoload.php';

$credentials = new Credentials('3', '278d425bdf160c739803', '7ad3773142a6692b25b8');
$transport = new Curl($credentials);
$client = new Client($transport);

$client->trigger('test_channel', 'send', ['message' => 'test']);

Guzzle

注意:您必须已安装Guzzle。

<?php
use Tackk\Shover\Credentials;
use Tackk\Shover\Transport\Guzzle;
use Tackk\Shover\Client;

require 'vendor/autoload.php';

$credentials = new Credentials('3', '278d425bdf160c739803', '7ad3773142a6692b25b8');
$transport = new Guzzle($credentials);
$client = new Client($transport);

$client->trigger('test_channel', 'send', ['message' => 'test']);