ampahkwabena / ice-and-fire
Ic & Fire PHP 包是用于访问 https://anapioficeandfire.com/ 的包装器
v1.0.0
2022-02-20 23:45 UTC
Requires
- guzzlehttp/guzzle: ^7.2
- phpseclib/phpseclib: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.5.10
This package is not auto-updated.
Last update: 2024-10-01 10:03:35 UTC
README
概览
IceOnFire 是访问 AnApiOfIceAndFire 的 PHP 包包装器。
安装
A-song-of-ice-and-fire-API 的当前生产版本可通过 Composer 获取
composer require ampahkwabena/ice-and-fire
使用方法
> use AmpahKwabena\Anapioficeandfire; > $ice_and_fire = new Anapioficeandfire(); > return $ice_and_fire->getAllBooks(); [ { url: 'http://www.anapioficeandfire.com/api/characters/583', name: 'Jon Snow', gender: 'Male', culture: 'Northmen', born: 'In 283 AC', died: '', titles: [ 'Lord Commander of the Night\'s Watch' ], aliases: [ 'Lord Snow', 'Ned Stark\'s Bastard', 'The Snow of Winterfell', 'The Crow-Come-Over', 'The 998th Lord Commander of the Night\'s Watch', 'The Bastard of Winterfell', 'The Black Bastard of the Wall', 'Lord Crow' ], father: '', mother: '', spouse: '', allegiances: [ 'http://www.anapioficeandfire.com/api/houses/362' ], books: [ 'http://www.anapioficeandfire.com/api/books/5' ], povBooks: [ 'http://www.anapioficeandfire.com/api/books/1', 'http://www.anapioficeandfire.com/api/books/2', 'http://www.anapioficeandfire.com/api/books/3', 'http://www.anapioficeandfire.com/api/books/8' ], tvSeries: [ 'Season 1', 'Season 2', 'Season 3', 'Season 4', 'Season 5' ], playedBy: [ 'Kit Harington' ] } ]
API
角色
getCharacterByID
- 接受:表示角色 ID 的字符串或数字。
- 返回:如果角色存在,包含角色属性的对象。
getCharacterByName
- 接受:表示角色全名的字符串。
- 返回:包含具有给定名称的所有角色的对象数组。
getCharactersByCulture
- 接受:表示角色文化的字符串。
- 返回:包含具有给定文化的所有角色的对象数组。
getCharactersByGender
- 接受:表示角色性别的字符串。
- 返回:包含具有给定性别的所有角色的对象数组。
getAllCharacters
- 返回:包含所有角色的对象数组。
家族
getHouseByID
- 接受:表示家族 ID 的字符串或数字。
- 返回:如果家族存在,包含家族属性的对象。
getHouseByName
- 接受:表示家族全名的字符串。
- 返回:包含具有给定名称的所有家族的对象数组。
getHouseByRegion
- 接受:表示家族地区的字符串。
- 返回:包含具有给定地区的所有家族的对象数组。
getHouseByWords
- 接受:表示家族格言的字符串。
- 返回:包含具有给定格言的所有家族的对象数组。
getAllHouses
- 返回:包含所有家族的对象数组。
书籍
getBookByID
- 接受:表示书籍 ID 的字符串或数字。
- 返回:如果书籍存在,包含书籍属性的对象。
getBookByName
- 接受:表示书籍全名的字符串。
- 返回:包含具有给定名称的所有书籍的对象数组。
getAllBooks
- 返回:包含所有书籍的对象数组。
娱乐
getRandomCharacter
- 返回:包含随机角色的属性的对象。
getRandomHouse
- 返回:包含随机家族属性的对象。
getRandomCharacterOfHouse
- 接受:表示家族全名的字符串。
- 返回:包含给定家族中随机角色的属性的对象。