tmdroid/quotily

此包的最新版本(dev-master)没有可用的许可证信息。

从各种引言API检索引言的包

dev-master 2017-05-16 22:43 UTC

This package is auto-updated.

Last update: 2024-09-21 19:36:31 UTC


README

Quotily是一个PHP包,可以帮助您从各种引言服务API中获取著名引言

支持的API

使用方法

<?php

require_once __DIR__ . '/../../vendor/autoload.php'; // Autoload files using Composer autoload

use TMDroid\Apis\Supported;
use TMDroid\Quotily;

$apikey = "<YOUR_API_KEY_HERE>";

$quotily = new Quotily(Supported::$BEST_QUOTES, $apikey);
$quote = $quotily->getOneQuote();

var_dump($quote);
?>

来自var_dump的示例输出

class TMDroid\Quote#31 (5) {
  private $serviceName =>
  string(30) "Random Famous Quotes - Mashape"
  private $quote =>
  string(111) "Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws."
  private $author =>
  string(5) "Plato"
  private $length =>
  int(111)
  private $genre =>
  string(6) "Famous"
}

class TMDroid\Quote#31 (5) {
  private $serviceName =>
  string(20) "Bestquotes - Mashape"
  private $quote =>
  string(104) "But if you don't watch me, I will try and sneak in some humor. I see humor everywhere in life around me."
  private $author =>
  string(11) "Marion Ross"
  private $length =>
  int(104)
  private $genre =>
  string(5) "humor"
}

支持

如果您还想在这里列出其他API,请留言或提交一个pull-request。

谢谢! :)