承接 danielz/music-codes 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

danielz/music-codes

Composer 安装命令:

composer require danielz/music-codes

包简介

Music Codes PHP library provides handy tools for codes in the music industry

README 文档

README

License Build Status Coverage Status

Music Codes

Music Codes PHP library provides handy tools for codes in the music industry

Isrc

Note 1: for the country code portion of the ISRC the library only checks if it is comprised of 2 alphabetical characters

Note 2: ISRC with id 0 are not considered valid; example: GB-A1B-11-00000 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

Setting ISRC parts:

$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; 

Different formatting options:

$isrc = new Isrc('GB-A1B-11-00003');

// outputs dashed ISRC: 'GB-A1B-11-00003'
echo $isrc->getIsrc(true) . PHP_EOL;

// outputs ISRC without dashes:'GBA1B1100003'
echo $isrc->getIsrc(false) . PHP_EOL;

// outputs ISRC withot dashes and prefixed: 'ISRC GBA1B1100003'
echo $isrc->getIsrc(false, true) . PHP_EOL;

Navigating up & down:

$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

There are various ways to instantiate an ISWC object:

$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');

Navigating up & down:

$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();

Formatting:

$iswc = new Iswc('T-034.524.680-1');

echo $iswc; // outputs 'T-034.524.680-1'

echo $iswc->getIswc(true); // outputs 'T-034.524.680-1'
echo $iswc->getIswc(false); // outputs 'T0345246801'

Label Code

There are various ways to instantiate an LabelCode object:

$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');

Navigating up & down:

$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();

Formatting:

$label_code = new LabelCode('LC-1234');

echo $label_code; // outputs 'LC1234'

echo $label_code->gecLabelCode(true); // outputs 'LC-1234'
echo $label_code->gecLabelCode(false); // outputs 'LC1234'

Changelog

v1.3.1

  • add method treatZeroIdsAsValid to Isrc class to enable validation of ISRC codes where the id is 0
  • add param to isValid method in Isrc class to enable revalidation on demand

License

MIT License

See COPYING to see the full text.

danielz/music-codes 适用场景与选型建议

danielz/music-codes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.79k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「code」 「music」 「isrc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 danielz/music-codes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 danielz/music-codes 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 8.79k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-30