jhnbrn90/cas-validator

Parse and validate a given CAS number

dev-master 2022-10-22 20:32 UTC

This package is auto-updated.

Last update: 2024-04-23 00:08:57 UTC


README

This PHP package allows easy parsing and validation of CAS numbers as dictated by the ACS.

Usage

To use this package, first require it:

composer require jhnbrn90/cas-validator

Validating a CAS number is performed as follows:

use Jhnbrn90\CasValidator\CasNumberValidator;

$validatedCas = CasNumberValidator::validate('100-39-0');

// This will yield a `ValidCasNumber` or `InvalidCasNumber` DTO

$isValid = $validatedCas->isValid(); // boolean