定制 hampom/bari-kata 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

hampom/bari-kata

最新稳定版本:0.0.2

Composer 安装命令:

composer require hampom/bari-kata

包简介

Map

README 文档

README

🍜 型安全・配列禁止を徹底した PHP コレクションライブラリ 「BariKata」は TypedCollection を中心に設計され、プラグイン拡張やファクトリーによる標準セット化が可能です。

特徴

  • 型安全なコレクション
    指定したクラス以外は格納できません。 ArrayAccess で自然に操作可能。
  • プラグイン拡張
    map, filter, orderBy などの操作を簡単に追加できます。
  • Factory
    あらかじめ定義したプラグインセットを有効化した状態でコレクションを生成可能。

インストール

composer require hampom/bari-kata

使い方

TypedCollection の生成

use Hampom\BariKata\TypedCollection;

$ids = new TypedCollection('int');
$ids[] = 1;
$ids[] = 2;

// -> InvalidArgumentException: Value must be of type int, string given.
// $ids[] = 'a';

プラグインの追加

use Hampom\BariKata\TypedCollection;
use Hampom\BariKata\Plugins\toArray;

$ids = new TypedCollection('int', [0], [new toArray]);
$ids[] = 1;

// -> array(0 => 0, 1 => 1)
var_export($ids->toArray());

ファクトリーの利用

final class IntCollectionFactory extends TypedCollectionFactory
{
    protected static string $type = 'int';

    protected static function plugins(): array
    {
        return [
            ["class" => toArray::class]
        ];
    }
}

$ids = (new IntCollectionFactory)->factory([0]);
$ids[] = 1;

// -> array(0 => 0, 1 => 1)
var_export($ids->toArray());

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固