fdt2k/isbn
Composer 安装命令:
composer require fdt2k/isbn
包简介
A PHP library to convert and validate ISBNs
README 文档
README
biblys/isbn can be used to:
- validate a string against the ISBN-10, ISBN-13 and EAN-13 formats
- convert an ISBN to ISBN-10, ISBN-13, EAN-13, GTIN-14 and ISBN-A/DOI formats
- parse an ISBN and extract registration agency, publisher code, publication code, checksum, etc.
Installation
Requirements
- PHP 7.x
If you need to support PHP 8, see the next branch.
Install with composer
composer require biblys/isbn:^2.5.0
Usage
Convert
Use case: converting an EAN (9782843449499) to an ISBN-13 (978-2-84344-949-9).
<?php use Biblys\Isbn\Isbn; try { $input = "9782843449499"; $isbn13 = Isbn::convertToIsbn13($input); echo "ISBN-13: $isbn13"; // Prints ISBN-13: 978-2-84344-949-9 } catch(Exception $e) { echo "An error occurred while attempting to format ISBN $input: ".$e->getMessage(); }
All formatting methods:
Isbn::convertToIsbn10Isbn::convertToIsbn13Isbn::convertToEan13Isbn::convertToGtin14Isbn::convertToIsbnA
Validate
Use case: validating an incorrectly formed ISBN-13 (978-2-843-44949-9, should be 978-2-84344-949-9).
<?php use Biblys\Isbn\Isbn; try { $input = "978-2-843-44949-9"; Isbn::validateAsIsbn13($input); echo "ISBN $input is valid!"; } catch(Exception $e) { // Will throw because third hyphen is misplaced echo "ISBN $input is invalid: ".$e->getMessage(); }
All validating methods:
Isbn::validateAsIsbn10Isbn::validateAsIsbn13Isbn::validateAsEan13Isbn::isParsable
Learn more about validating ISBNs
Development
Using Gitpod
You can start a dev environment by clicking
and start hacking in your browser right away!
Locally
If you'd rather set up a local dev environment, you'll need:
- PHP 7.x
- Composer
- (Optional) Docker to run tests and debug against different version of PHP
Clone this repository and run composer install to get started!
Tests
Run tests with PHPUnit:
composer install composer test
Run tests in a docker container:
composer docker:test
Run tests in a docker container using a specific PHP version:
PHP_VERSION=7.1 composer docker:test
ISBN ranges update
New ISBN ranges may be added from time to time by the International ISBN Agency. Whenever it happens, this library must be updated. If a range update is necessary, please open an issue on GitHub. You can also open a pull request after updating the ranges your self with the following commands:
composer install composer run update-ranges
Or using a docker container:
composer docker:update-ranges
Changelog
fdt2k/isbn 适用场景与选型建议
fdt2k/isbn 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 05 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「book」 「ean」 「ISBN」 「gtin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fdt2k/isbn 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fdt2k/isbn 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fdt2k/isbn 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Book publishing application
GS1 parser and generator for PHP
📇 PHP library for address book contacts (make vCards for contacts)
A PHP class for EAN and ISBN name lookup and validation using the API on ean-search.org
Advanced Guestbook for TYPO3 - TYPO3 Guestbook Extension easily integrates all the features of a guestbook, including a review form with email sending functionality. This TYPO3 guestbook plugin also includes spam protection and numerous customization options. Guests can share their reviews, ratings,
Laravel Wrapper for UPCItemDB.
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-11