siegsb / radiorush
CentovaCast API 的完整 PHP 库
dev-master
2017-06-12 20:42 UTC
Requires
- php: >=5.4
Requires (Dev)
- phpdocumentor/phpdocumentor: 2.*
- phpunit/phpunit: >=4.8
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-09-11 02:34:11 UTC
README
Centova Cast API 的完整 PHP 库。
使用此 PHP 库,您可以
- 向您的 Centova Cast API 发送请求
- 自动格式化或将响应作为数组或 JSON 对象输出
- 使用您的 Centova Cast 控面板的不同用户创建多个实例
- 此库仅返回 API 响应的有用数据
要求
- PHP 5.4 或更高版本
- CURL PHP 扩展(可选但推荐)
- 在您的 PHP.ini 中启用参数 "allows_include_url"
如何安装和使用
您可以通过在 composer.json 中的 require 数组中添加以下行来通过 Composer 安装 RadioRush:
"siegsb/radiorush":"*"
然后在终端运行 "composer update"。现在您可以使用 autoload.php 文件使用 RadioRush。
命名空间是 \SiegSB\RadioRush,因此您可以使用以下方式在代码中包含库:
<?php
require_once ('vendor/autoload.php');
use \SiegSB\RadioRush;
....
// Now you can creates a new instance of RadioRush
$rr = new RadioRush;
// Also you can define directly the namespace in your instance
// Use this instance method if you do not want to use 'use \SiegSB\RadioRush;'
$rr = new \SiegSB\RadioRush\RadioRush;
之后,您需要使用以下参数使用 "setConnect" 方法与您的 Centova 服务器建立新的连接:
-
string $server:您的 Centova 服务器 URL(不带末尾斜杠)。例如:"http://centova.example.com"
-
string $username:您的 Centova 账户用户名
-
string $password:您的 Centova 账户的明文密码
$rr->setConnect('http://centova.example.com', 'username', 'password');
当您设置新的连接时,您可以向 Centova API 发送请求。如果您想使用另一个连接,可以覆盖 setConnect 方法或创建 RadioRush 的不同实例。
如果您想捐赠,请使用 PayPal 并将您的捐赠发送到电子邮件 sieg.sb@gmail.com,谢谢!