mormon-projects-group / gospel-library
用于访问LDS福音图书馆网络服务的PHP库
0.1.2
2022-03-15 17:28 UTC
Requires
- php: ^7.0
- guzzlehttp/guzzle: ^6.0
Requires (Dev)
- phpdocumentor/phpdocumentor: 2.*
- phpunit/phpunit: ^6.5
README
LDS福音图书馆
本项目与LDS教会无关,也未得到其认可或支持。 LDS Church.
这个小巧的PHP库允许轻松访问福音图书馆网络服务。这些服务仅提供对库的元数据访问,而不是任何内容或功能(如搜索、高亮、笔记、标签和书签)。
本项目提供对元数据的访问,但不提供实际内容。所有福音图书馆中的内容版权均归知识产权储备公司所有。
福音图书馆客户端
目前对LDS福音图书馆有五个(5)有效的API操作
languages.query- 存在该库的语言列表
platforms.query- 存在该库的有效平台列表
catalog.query- 指定语言和平台下的目录内容列表
catalog.query.modified- 指定语言和平台下的目录最后更新日期
book.versions- 指定语言和平台下,自给定日期以来更新的书籍列表
以下所有方法都返回一个对象
语言
存在该库的语言列表。
<?php $client = new Gospel\Client; $results = $client->languagesQuery(); var_dump($results); ?>
示例返回
<?php object(stdClass)[129] public 'languages' => array (size=107) 0 => object(stdClass)[36] public 'id' => int 204 public 'name' => string 'Afrikaans' (length=9) public 'eng_name' => string 'Afrikaans' (length=9) public 'code' => string 'afr' (length=3) public 'code_three' => string 'afr' (length=3) public 'lds_xml_code' => string '501' (length=3) public 'android_sdk_version' => string '8' (length=1) 1 => object(stdClass)[38] public 'id' => int 25 public 'name' => string 'Shqip' (length=5) public 'eng_name' => string 'Albanian' (length=8) public 'code' => string 'sq' (length=2) public 'code_three' => string 'sqi' (length=3) public 'lds_xml_code' => string '101' (length=3) public 'android_sdk_version' => string '8' (length=1) 2 => object(stdClass)[33] public 'id' => int 63 public 'name' => string '\u12a0\u121b\u122d\u129b' (length=12) public 'eng_name' => string 'Amharic' (length=7) public 'code' => string 'am' (length=2) public 'code_three' => string 'amh' (length=3) public 'lds_xml_code' => string '506' (length=3) public 'android_sdk_version' => string '14' (length=2) …etc. public 'count' => int 107 public 'success' => boolean true public 'date_changed' => string '2018-01-03 05:00:00' (length=19) public 'platformid' => null ?>
平台
存在该库的有效平台列表。
<?php $client = new Gospel\Client; $results = $client->platformsQuery(); var_dump($results); ?>
示例返回
<?php object(stdClass)[28] public 'platforms' => array (size=16) 0 => object(stdClass)[27] public 'id' => int 1 public 'name' => string 'iPhone' (length=6) public 'extension' => string 'zbook' (length=5) public 'catalog_version' => string '1000' (length=4) 1 => object(stdClass)[16] public 'id' => int 10 public 'name' => string 'WebOS' (length=5) public 'extension' => string 'json' (length=4) public 'catalog_version' => string '1000' (length=4) …etc. public 'count' => int 16 public 'success' => boolean true ?>
目录
指定语言和平台下的目录内容列表。
<?php $client = new Gospel\Client; // Params: Language ID, Platform ID $results = $client->catalogQuery(1, 1); print_r($results); ?>
示例返回
<?php stdClass Object ( [catalog] => stdClass Object ( [folders] => Array ( [0] => stdClass Object ( [display_order] => 0 [name] => Scriptures [eng_name] => [id] => 1 [languageid] => 1 [daysexpire] => 0 [download_all] => [folders] => Array ( [0] => stdClass Object ( [display_order] => 0 [name] => Study Helps [eng_name] => [id] => 2 [languageid] => 1 [isprivate] => 0 [download_all] => [daysexpire] => 0 [folders] => Array ( ) [books] => Array ( [0] => stdClass Object ( [name] => Topical Guide [full_name] => Topical Guide [description] => [gl_uri] => /scriptures/tg [url] => http://broadcast3.lds.org/crowdsource/Mobile/glweb2/1/1/TG.9.zbook [display_order] => 0 [version] => 8 [file_version] => 9 [file] => TG.9.zbook [dateadded] => 2010-06-23 16:28:49 [datemodified] => 2013-02-28 22:00:54 [id] => 7 [cb_id] => 7 [media_available] => 0 [obsolete] => [size] => 2248470 [size_index] => 2969366 ) [1] => stdClass Object ( [name] => Bible Dictionary [full_name] => Bible Dictionary [description] => This dictionary has been designed to provide teachers and students with a concise collection of definitions and explanations of items that are mentioned in or are otherwise associated with the Bible. It is based primarily upon the biblical text, supplemented by information from the other books of scripture accepted as standard works by The Church of Jesus Christ of Latter-day Saints. It is not intended as an official or revealed endorsement by the Church of the doctrinal, historical, cultural, and other matters set forth. Many of the items have been drawn from the best available scholarship of the world and are subject to reevaluation based on new research and discoveries or on new revelation. The topics have been carefully selected and are treated briefly. If an elaborate discussion is desired, the student should consult a more exhaustive dictionary. [gl_uri] => /scriptures/bd [url] => http://broadcast3.lds.org/crowdsource/Mobile/glweb2/1/1/BD.9.zbook [display_order] => 1 [version] => 8 [file_version] => 9 [file] => BD.9.zbook [dateadded] => 2010-06-23 16:29:13 [datemodified] => 2013-02-28 22:01:29 [id] => 8 [cb_id] => 8 [media_available] => 0 [obsolete] => [size] => 552203 [size_index] => 765119 ) ) ) ) ) ) …etc [name] => All English content [date_changed] => 2016-09-06 15:09:08 [display_order] => 0 ) [success] => 1 ) ?>
目录更新
指定语言和平台下的目录最后更新日期。
<?php $client = new Gospel\Client; // Params: Language ID, Platform ID $results = $client->catalogQueryModified(1, 1); var_dump($results); ?>
示例返回
<?php object(stdClass)[36] public 'version' => string '159' (length=3) public 'catalog_modified' => string '2016-09-06 15:09:08' (length=19) public 'success' => boolean true ?>
书籍版本
指定语言和平台下,自给定日期以来更新的书籍列表。
<?php $client = new Gospel\Client; // Params: Language ID, Platform ID, Date $results = $client->bookVersions(1, 1, '2016-09-02'); var_dump($results); ?>
示例返回
<?php object(stdClass)[20] public 'books' => array (size=8) 0 => object(stdClass)[36] public 'id' => int 76447 public 'version' => int 1 1 => object(stdClass)[38] public 'id' => int 76448 public 'version' => int 1 2 => object(stdClass)[33] public 'id' => int 76449 public 'version' => int 1 3 => object(stdClass)[39] public 'id' => int 76450 public 'version' => int 1 4 => object(stdClass)[31] public 'id' => int 76451 public 'version' => int 1 5 => object(stdClass)[32] public 'id' => int 76452 public 'version' => int 1 6 => object(stdClass)[27] public 'id' => int 76453 public 'version' => int 1 7 => object(stdClass)[21] public 'id' => int 76454 public 'version' => int 1 ?>
解析器
目录解析器
解析由catalogQuery()方法返回的数据。
<?php $client = new Gospel\Client; // Params: Language ID, Platform ID // Return: stdObject object $results = $client->catalogQuery(1, 1); $parser = new Gospel\Parser\Catalog($results); // Return: boolean $success = $parser->getSuccessStatus(); // Return: DateTime object $modifiedDate = $parser->getModifiedDate(); // Return: string $catalogName = $parser->getCatalogName(); // Return: stdObject Object containing an adjacency list model for hierarchical data $folders = $parser->getFolders(); // Return: stdObject Object containing an adjacency list model for hierarchical data $books = $parser->getBooks(); // Return: stdObject Object containing an adjacency list model for hierarchical data $files = $parser->getFiles(); ?>
注意
同一本书在不同的语言中会有不同的ID号码,但如果平台不同则不会。例如,英文版《摩门经》的ID为95,而西班牙语版的ID为1686。然而,摩门经的.zbook和.json版本共享ID95。