pubconnect/isbn-urn
最新稳定版本:0.0.4
Composer 安装命令:
composer require pubconnect/isbn-urn
包简介
An experiment to add deeplinks/fragments to urn:isbn
README 文档
README
An experiment/draft to add readable deeplinks and fragments using the urn format. The aim is to support both 'digital' and 'physical' usecases of (book) publications.
The provided basic libraries and documentation allows to test, experience, adjust and extend its usability within various (development) environments and applications.
Please and post issues and pull requests in the base project. Also see the extended README located there
Installing
composer require pubconnect/isbn-urn
Usage
CREATE :: a URN string
use Pubconnect\IsbnUrn\IsbnUrn; $urnParser = new IsbnUrn(); $urnParser->setNamespaceIdentifier('isbn'); $urnParser->setNamespace('9795363916662'); $urnParser->setTocItem('3.3.3'); $urnParser->setOffset(10, 34); $urnParser->setTextFragment('de lelijke vos sprong in de bosjes'); echo $urnParser->getUrn();
UPDATE :: a existing URN string
use Pubconnect\IsbnUrn\IsbnUrn; $urnString = "urn:isbn:9795363916662"; $urnParser = new IsbnUrn($urnString); $urnParser->setTocItem('4.3.2'); $urnParser->setOffset(0, 340); $urnParser->setTextFragment('de lelijke vos sprong in de bosjes'); echo $urnParser->getUrn(); echo PHP_EOL.PHP_EOL;
PARSE :: URN strings
use Pubconnect\IsbnUrn\IsbnUrn; $urnStrings[] = "urn:isbn:9795363916662"; $urnStrings[] = "urn:isbn:9795363916662?segmentnum=5"; $urnStrings[] = "urn:isbn:9795363916662?tocitem=3.3.3"; $urnStrings[] = "urn:isbn:9795363916662?tocitem=3.3.3#offset(150)"; $urnStrings[] = "urn:isbn:9795363916662?tocitem=3.3.3#offset(10,34)"; $urnStrings[] = "urn:isbn:9795363916662?tocitem=3.3.3#offset(10,34)de+lelijke+vos+sprong+in+de+bosjes"; foreach($urnStrings as $urnString){ $urnParser = new IsbnUrn($urnString); echo "URN: " . $urnParser->getUrn() . PHP_EOL; echo "Namespace Identifier: " . $urnParser->getNamespaceIdentifier() . PHP_EOL; echo "Namespace: " . $urnParser->getNamespace() . PHP_EOL; echo "TOC Item: " . $urnParser->getTocItem() . PHP_EOL; echo "Segment Number: " . $urnParser->getSegmentNum() . PHP_EOL; echo "Offset: "; echo var_export($urnParser->getOffset(), true).PHP_EOL; echo "Text Fragment: " . $urnParser->getTextFragment() . PHP_EOL; echo PHP_EOL.PHP_EOL; }
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-10