fdt2k/isbn 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fdt2k/isbn

Composer 安装命令:

composer require fdt2k/isbn

包简介

A PHP library to convert and validate ISBNs

README 文档

README

tests Latest Stable Version Total Downloads License Gitpod ready-to-code

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.

CHANGELOG

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::convertToIsbn10
  • Isbn::convertToIsbn13
  • Isbn::convertToEan13
  • Isbn::convertToGtin14
  • Isbn::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::validateAsIsbn10
  • Isbn::validateAsIsbn13
  • Isbn::validateAsEan13
  • Isbn::isParsable

Learn more about validating ISBNs

Development

Using Gitpod

You can start a dev environment by clicking Gitpod ready-to-code 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

See GitHub releases

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 我们能提供哪些服务?
定制开发 / 二次开发

基于 fdt2k/isbn 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-11