定制 enzyme/freckle 二次开发

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

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

enzyme/freckle

Composer 安装命令:

composer require enzyme/freckle

包简介

A collection of dot-based information retrieval helpers... wuh?

README 文档

README

Build Status Coverage Status Scrutinizer Code Quality

Freckle is a collection of information accessors. It allows you to traverse and get the values in arrays and other collection types using dot separated paths. For example, getting the value in a multi-dimensional-associative array for users.bob456.name, given the array:

$array = [
    'users' => [
        'jane123' => ['name' => 'Jane Foo'],
        'bob456'  => ['name' => 'Bob Foo'],
    ]
];

would return the value of Bob Foo. Pretty straight forward hey?

Installation

composer require enzyme/freckle

Usage

Getting a value from a simple collection.

use Enzyme\Freckle\Dot;

$array = [
    'users' => [
        'jane123' => ['name' => 'Jane Foo'],
        'bob456'  => ['name' => 'Bob Foo'],
    ]
];

$dot = new Dot;
$full_name = $dot->get($array, 'users.bob456.name'); // returns "Bob Foo".

Getting a value from a simple collection with numeric keys.

use Enzyme\Freckle\Dot;

$array = [
    'users' => [
        0 => [
            'jane123' => ['name' => 'Jane Foo'],
        ],
        1 => [
            'bob456'  => ['name' => 'Bob Foo'],
        ]
    ]
];

$dot = new Dot;
$full_name = $dot->get($array, 'users.bob456.name'); // returns "Bob Foo".

In the event that a collection has numeric keys or supports multiple entries with the same key name, only the first result found will ever be returned.

If no value can be found, null will be returned instead. Be careful though if you're checking against the null value for success as you may get false positives if an actual value was found, but that value happens to be null.

Contributing

Please see CONTRIBUTING.md

License

MIT - Copyright (c) 2015 Tristan Strathearn, see LICENSE

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固