michaels/data-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

michaels/data-manager

Composer 安装命令:

composer require michaels/data-manager

包简介

Simple data manager for nested data, dot notation array access, extendability, and container interoperability.

README 文档

README

While this still works, it should be considered abandoned. Any PR issued will be accepted w/o question. If you want to own this repository, open an issue and contact me.

Data Manager

Latest Version Documentation Status Software License Build Status Coverage Status Scrutinizer Code Quality Total Downloads

SensioLabsInsight

Simple data manager for nested data, dot notation access, extendability, and container interoperability.

See Full Documentation

Goals

  • Light weight and fluent, simple, clear API
  • Manage nested data via dot-notation
  • Be composable - integrate into current containers via traits (extras)
  • Include extras for
  • Allow for protected data (immutable) and default values.
  • IoC container should:
    • Resolve via classes, factories, etc
    • Configure dependencies for dependencies,
    • Allow for fallbacks, preparing objects, and more.
  • Full test coverage, PSR compliant, container interoperability, and best practices

Install

Via Composer

$ composer require michaels/data-manager

Getting Started

Manager does exactly what you would expect: it manages complex items such as config data, arrays, and closures. The best way to get started is simply instantiate Michaels\Manager\Manager

$manager = new Michaels\Manager\Manager([
    'some' => [
        'starting' => [
            'data' => 'here (optional)'
        ]
    ]
]);
// Note, you may initialize Manager with an array or any instance of Traversable (like Manager itself)

/* Basic Usage. All works with dot notation as well */
$manager->add('name', 'value');
$manager->add('some.nested.data', 3); // Use dot notation for namespacing or nesting
$manager->get('name'); // 'value'
$manager->get('doesntexist', 'fallback'); // 'fallback'
$manager->get('doesntexist') // throws an ItemNotFoundException with no fallback
$manager->getIfHas('doesntexist') // returns a NoItemFoundMessage instead of a script-stopping exception
$manager->getAll(); // returns array of all items
$manager->all(); // returns array of all items
$manager->exists('name'); // true
$manager->exists('some.starting.data'); // true
$manager->exists('nope'); // false
$manager->has('something'); // alias of exist
$manager->set('name', 'new-value'); // updates item
$manager->remove('some.starting.data');
$manager->isEmpty(); // true or false
$manager->toJson(); // returns json of all items
echo $manager; // returns json string of all items
$manager->reset($array); // rebuild with new items
$manager->clear(); // empty the manager

/* You can also use $manager as an array or in loops */
$manager['some']['starting']['data']; // 'here (optional)'
//etc

foreach ($manager as $item => $value) {
    // do whatever your heart desires
}

/* You may also push elements onto an array */
$manager->set('a.b', []);
$manager->push('a.b', 'c', 'd', 'e');
$manager->get('a.b'); // ['c', 'd', 'e']

/* Finally, you may manage values using magic methods */
$manager->some()->starting()->data; // 'here (optional)'
$manager->some()->item = 'item'; // sets some.item = 'item'
$manager->some()->item()->drop(); // deletes some.item

// Note that levels are called as a method with no params. The data is then called, updated, or set as a property.

Advanced Features

See documentation for topics like protecting data, using as an ioc container, loading files, using as an array, defaults, composing, and more.

Interoperability

Data Manager is PSR compliant and Container Interoperability compliant. Any oversights, please let me know.

Testing

We try for at least 80% test coverage.

$ phpunit

You may also use the tests under tests/traits to test your integrated functionality. You may have to grab these through cloning the repo. composer usually won't include tests in your require

Contributing

Contributions are welcome and will be fully credited. Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email chrismichaels84@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

michaels/data-manager 适用场景与选型建议

michaels/data-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.96k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2015 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 michaels/data-manager 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 1.96k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 24
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 6
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-19