{"id":15482453,"url":"https://github.com/daniel-zahariev/music-codes","last_synced_at":"2025-04-22T15:41:09.303Z","repository":{"id":56962003,"uuid":"205419052","full_name":"daniel-zahariev/music-codes","owner":"daniel-zahariev","description":"Music Codes PHP library provides handy tools for codes in the music industry","archived":false,"fork":false,"pushed_at":"2022-05-13T14:23:36.000Z","size":18,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T05:18:33.313Z","etag":null,"topics":["code","isrc","music"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daniel-zahariev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-30T16:29:38.000Z","updated_at":"2024-09-13T07:50:08.000Z","dependencies_parsed_at":"2022-08-21T05:40:18.032Z","dependency_job_id":null,"html_url":"https://github.com/daniel-zahariev/music-codes","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-zahariev%2Fmusic-codes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-zahariev%2Fmusic-codes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-zahariev%2Fmusic-codes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-zahariev%2Fmusic-codes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daniel-zahariev","download_url":"https://codeload.github.com/daniel-zahariev/music-codes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250269884,"owners_count":21402956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","isrc","music"],"created_at":"2024-10-02T05:09:13.687Z","updated_at":"2025-04-22T15:41:09.276Z","avatar_url":"https://github.com/daniel-zahariev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/daniel-zahariev/music-codes/blob/master/COPYING)\n[![Build Status](https://app.travis-ci.com/daniel-zahariev/music-codes.svg?branch=master)](https://app.travis-ci.com/github/daniel-zahariev/music-codes)\n[![Coverage Status](https://coveralls.io/repos/github/daniel-zahariev/music-codes/badge.svg?branch=master)](https://coveralls.io/github/daniel-zahariev/music-codes?branch=master)\n\n# Music Codes\n\n\nMusic Codes PHP library provides handy tools for codes in the music industry\n\nIsrc\n====\n\n**Note 1: for the country code portion of the ISRC the library only checks if it is comprised of 2 alphabetical characters** \n\n~~**Note 2: ISRC with id 0 are not considered valid; example: `GB-A1B-11-00000`**~~\n**Updated Note2: ISRCs with id 0 can now be treated as valid by calling a static method on the class prior it's general use**\n\n\nSetting ISRC parts:\n\n```php\n\n$isrc = new Isrc();\n$isrc-\u003esetCountryCode('GB');\n$isrc-\u003esetIssuerCode('A1B');\n$isrc-\u003esetYear(11);\n$isrc-\u003esetId(3);\n\n// Prefix is the combination of country code and issuer code\n// and is now adopted as standard wording in ISRC specification\n// in order to allow allocation of ranges of ISRCs\n$isrc-\u003esetPrefix('GB-A1B'); // can be used with or without the dash   \n\n// will output 'Valid'\necho ($isrc-\u003eisValid() ? 'Valid' : 'Not valid') . PHP_EOL;\n\n// By default, the ids equal to zero are not considered as valid\n// so to enable this globally you should call the following method:\nIsrc::treatZeroIdsAsValid(true);\n\n$isrc = new Isrc('GB-A1B-11-00000')\n// will output 'Valid'\necho ($isrc-\u003eisValid() ? 'Valid' : 'Not valid') . PHP_EOL; \n\n```\n\nDifferent formatting options:\n\n```php\n\n$isrc = new Isrc('GB-A1B-11-00003');\n\n// outputs dashed ISRC: 'GB-A1B-11-00003'\necho $isrc-\u003egetIsrc(true) . PHP_EOL;\n\n// outputs ISRC without dashes:'GBA1B1100003'\necho $isrc-\u003egetIsrc(false) . PHP_EOL;\n\n// outputs ISRC withot dashes and prefixed: 'ISRC GBA1B1100003'\necho $isrc-\u003egetIsrc(false, true) . PHP_EOL;\n\n```\n\nNavigating up \u0026 down:\n\n```php\n\n$isrc = new Isrc('GB-A1B-11-00003');\n\n// go one down and if it's valid output it\n// outputs 'GB-A1B-11-00002'\nif ($isrc-\u003eprevious()) {\n\techo $isrc-\u003egetIsrc(true) . PHP_EOL;\n}\n\n// reset\n$isrc-\u003eload('GB-A1B-11-00003');\n\n// go one up\n$isrc-\u003enext();\n\n// go one up and if it's valid output it\n// outputs 'GB-A1B-11-00004'\nif ($isrc-\u003enext()) {\n\techo $isrc-\u003egetIsrc(true) . PHP_EOL;\n}\n\n```\n\nISWC\n====\n\nThere are various ways to instantiate an ISWC object:\n\n```php\n\n$iswc = new Iswc('T-034.524.680-1'); // use either all separators\n$iswc = new Iswc('T0345246801'); // or none\n\n$iswc = Iswc::fromId('034.524.680');\n$iswc = Iswc::fromId('034524680');\n\n```\n\nNavigating up \u0026 down:\n\n```php\n\n$iswc = new Iswc('T-034.524.680-1');\n\n// Bumps up the id and auto-calculates the check digit\n// the ISWC is now: T-034.524.681-2\n$iswc-\u003enext();\n\n// reset\n$iswc-\u003eload('T-034.524.680-1');\n\n// the ISWC is now: T-034.524.679-8\n$iswc-\u003eprevious();\n\n```\n\nFormatting:\n\n```php\n\n$iswc = new Iswc('T-034.524.680-1');\n\necho $iswc; // outputs 'T-034.524.680-1'\n\necho $iswc-\u003egetIswc(true); // outputs 'T-034.524.680-1'\necho $iswc-\u003egetIswc(false); // outputs 'T0345246801'\n\n```\n\n\nLabel Code\n====\n\nThere are various ways to instantiate an LabelCode object:\n\n```php\n\n$label_code = new LabelCode('LC-1234'); // dashes will be stripped by default\n$label_code = new LabelCode('LC1234');\n\n$label_code = LabelCode::fromParts('LC', 1234);\n$label_code = LabelCode::fromParts('LC-', '1234');\n\n```\n\nNavigating up \u0026 down:\n\n```php\n\n$label_code = new LabelCode('LC-1234');\n\n// Bumps up the id\n// the Label Code is now: LC-1235\n$label_code-\u003enext();\n\n// reset\n$label_code-\u003eload('LC-1234');\n\n// the Label Code is now: LC-1233\n$label_code-\u003eprevious();\n\n```\n\nFormatting:\n\n```php\n\n$label_code = new LabelCode('LC-1234');\n\necho $label_code; // outputs 'LC1234'\n\necho $label_code-\u003egecLabelCode(true); // outputs 'LC-1234'\necho $label_code-\u003egecLabelCode(false); // outputs 'LC1234'\n\n```\n\n\nChangelog\n=========\n\n**v1.3.1**\n- add method `treatZeroIdsAsValid` to Isrc class to enable validation of ISRC codes where the id is 0\n- add param to `isValid` method in Isrc class to enable revalidation on demand\n\n\nLicense\n=======\n\nMIT License\n\nSee [COPYING](COPYING) to see the full text.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-zahariev%2Fmusic-codes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel-zahariev%2Fmusic-codes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-zahariev%2Fmusic-codes/lists"}