thomasdcodes / isbn-library
The library provides a check if a ISBN-13 is valid or not. It also calculates a ISBN-13 check number with a given isbn root.
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/thomasdcodes/isbn-library
Requires
- php: >=7.2.0
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2025-10-29 03:03:35 UTC
README
The library provides a check if a ISBN-13 is valid or not. It also calculates a ISBN-13 check number with a given isbn root.
Install
composer require thomasdcodes/isbn-library
Use
The Class IsbnLibrary only allows static usage.
Use IsbnLibrary::sanitizeIsbn('978-3-123-45678-9') to remove all hyphens.
Use IsbnLibrary::isIsbn13Valid('978-3-123-45678-9') to check a ISBN is valid or not.
Use IsbnLibrary::calculateIsbn13CheckNumber('978-3-123-45678') to calculate the check number for a given ISBN-13 root.
Both functions (IsbnLibrary::isIsbn13Valid() and IsbnLibrary::calculateIsbn13CheckNumber()) are calling
the IsbnLibrary::sanitizeIsbn() function before any other calculations. So you can give a ISBN-13 with hyphens.
Tests
All ISBN-13 numbers insight the tests were make by fantasy. If there is any valid ISBN-13 write me an email and I will change it to another ISBN-13.