orthosie/theysaidso-quotes
最新稳定版本:v1.0.0
Composer 安装命令:
composer require orthosie/theysaidso-quotes
包简介
A fluent PHP client for world famous They Said So quotes platform.
README 文档
README
A fluent php client library for They Said So quotes API. You can get the API key here. [https://theysaidso.com/api]
Installation
composer require orthosie/theysaidso-quotes
Get Quote of the day
use TheySaidSo\QuoteOfTheDay;
$qod = QuoteOfTheDay::withCredential('<apikey>')->category('inspire')->get();
print "Quote of the day\n";
print $qod[0]['quote'] ." - " . $qod[0]['author'] . "\n";
Get Random Quote
Get a random quote
use TheySaidSo\Quotes;
$quotes = Quotes::withCredential(<api-key>)->random()->limit(1)->get();
print "A quote by " . $quotes[0]['author'] . "\n";
print $quotes[0]['quote'] ."\n";
Search Quotes
Search for a quote from Steve Jobs that says something about design
use TheySaidSo\Quotes;
$quotes = Quotes::withCredential(<api-key>)->search('design')->author('Steve Jobs')->get();
print "A quote by " . $quotes[0]['author'] . " on design\n";
print $quotes[0]['quote'] ."\n";
Full Options on search
Here are the full options on search API.
use TheySaidSo\Quotes;
$quotes = Quotes::withCredential(<api-key>)
->search('design')
->author('Steve Jobs')
->category('experience') // quote should have a tag 'experience'
->minLength(10) // quote length should be > 10 characters
->maxLength(512) // quote length should be < 512 characters
->sfw(true) // Search only Safe for work quotes
->private(false) // Search public quotes not quotes added by you
->get();
print "A quote by " . $quotes[0]['author'] . " on design\n";
print $quotes[0]['quote'] ."\n";
Rate Limit Numbers
After you make a call to the server you can get the rate limit numbers from the client library.
use TheySaidSo\Quotes;
$theysaidso = Quotes::withCredential(<api-key>);
$quotes = $theysaidso->random()->limit(1)->get();
print "Total limit for this period " . $theysaidso->totalLimit() . "\n";
print "Limit remaining " . $theysaidso->limitRemaining() . "\n";
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-08-15