1. Go to this page and download the library: Download danielz/music-codes library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
danielz / music-codes example snippets
$isrc = new Isrc();
$isrc->setCountryCode('GB');
$isrc->setIssuerCode('A1B');
$isrc->setYear(11);
$isrc->setId(3);
// Prefix is the combination of country code and issuer code
// and is now adopted as standard wording in ISRC specification
// in order to allow allocation of ranges of ISRCs
$isrc->setPrefix('GB-A1B'); // can be used with or without the dash
// will output 'Valid'
echo ($isrc->isValid() ? 'Valid' : 'Not valid') . PHP_EOL;
// By default, the ids equal to zero are not considered as valid
// so to enable this globally you should call the following method:
Isrc::treatZeroIdsAsValid(true);
$isrc = new Isrc('GB-A1B-11-00000')
// will output 'Valid'
echo ($isrc->isValid() ? 'Valid' : 'Not valid') . PHP_EOL;
$isrc = new Isrc('GB-A1B-11-00003');
// go one down and if it's valid output it
// outputs 'GB-A1B-11-00002'
if ($isrc->previous()) {
echo $isrc->getIsrc(true) . PHP_EOL;
}
// reset
$isrc->load('GB-A1B-11-00003');
// go one up
$isrc->next();
// go one up and if it's valid output it
// outputs 'GB-A1B-11-00004'
if ($isrc->next()) {
echo $isrc->getIsrc(true) . PHP_EOL;
}
$iswc = new Iswc('T-034.524.680-1'); // use either all separators
$iswc = new Iswc('T0345246801'); // or none
$iswc = Iswc::fromId('034.524.680');
$iswc = Iswc::fromId('034524680');
$iswc = new Iswc('T-034.524.680-1');
// Bumps up the id and auto-calculates the check digit
// the ISWC is now: T-034.524.681-2
$iswc->next();
// reset
$iswc->load('T-034.524.680-1');
// the ISWC is now: T-034.524.679-8
$iswc->previous();
$label_code = new LabelCode('LC-1234'); // dashes will be stripped by default
$label_code = new LabelCode('LC1234');
$label_code = LabelCode::fromParts('LC', 1234);
$label_code = LabelCode::fromParts('LC-', '1234');
$label_code = new LabelCode('LC-1234');
// Bumps up the id
// the Label Code is now: LC-1235
$label_code->next();
// reset
$label_code->load('LC-1234');
// the Label Code is now: LC-1233
$label_code->previous();