h-util/belt
Composer 安装命令:
composer require h-util/belt
包简介
A handful of tools for PHP developers.
README 文档
README
A handful of tools for PHP developers.
Version 2.0.0 is out now. Clear documentation, improved tests and code quality.
Installation
In case you want to try it out, run:
php composer.phar require "h-util/belt:~2"
That will add Belt to your project as a Composer dependency.
Example
A little taste of Belt:
use Belt\Belt; Belt::max([1, 2, 3]) // => 3 Belt::flatten([1, [2, [3]]]) // => [1, 2, 3] Belt::last([1, 2, 3], 2) // => [2, 3]
What It Offers
- 60+ useful functions that you can use in your projects.
- Belt is fully tested.
- The source code is clean and documented.
Here is what is available to you:
boolean isDate(mixed $value)boolean isNumber(mixed $value)boolean isString(mixed $value)boolean isFunction(mixed $value)boolean isEmpty(mixed $value)boolean isEqual(mixed $left, mixed $right)boolean isBoolean(mixed $value)boolean isObject(mixed $value)boolean isArray(mixed $value)boolean isTraversable(mixed $value)boolean isNull(mixed $value)boolean has(mixed $object, string $key)array keys(mixed $object)array values(mixed $object)array methods(mixed $object)mixed copy(mixed $value)mixed extend(mixed $source, mixed $destination)mixed apply(mixed $object, Closure $closure)mixed defaults(mixed $object, array|mixed $defaults)string escape(string $string)string id(string $prefix = '')mixed with(mixed $value)void times(integer $number, Closure $closure)mixed cache(Closure $closure)mixed wrap(Closure $closure, Closure $wrapper)mixed compose(array $closures, array $arguments = array())void once(Closure $closure)mixed after(integer $number, Closure $closure)mixed|array first(array $elements, integer $amount = 1)array initial(array $elements, integer $amount = 1)array rest(array $elements, integer $index = 1)mixed|array last(array $elements, integer $amount = 1)array pack(array $elements)array flatten(array $elements)array range(integer $to, integer $from = 0, integer $step = 1)array difference(array $one, array $another)array unique(array $elements, Closure $iterator = null)array without(array $elements, array $ignore)array zip(array $one, array $another)integer indexOf(array $elements, mixed $element)array intersection(array $one, array $another)array union(array $one, array $another)void each(array $collection, Closure $iterator)array map(array $collection, Closure $iterator)array toArray(mixed $value)integer|null size(array|Countable $value)array shuffle(array $collection)boolean any(array $collection, Closure $iterator)boolean all(array $collection, Closure $iterator)array reject(array $collection, Closure $iterator)array pluck(array $collection, string $key)boolean contains(array $collection, mixed $value)array invoke(array $collection, string $function)mixed reduce(array $collection, Closure $iterator, mixed $initial = 0)array sortBy(array $collection, Closure $iterator)array groupBy(array $collection, Closure $iterator)mixed max(array $collection)mixed min(array $collection)
Development
Plans
- Add
PHP 5.6support - leverage variadic functions.
Features
- Collections [done]
- each [done]
- map [done]
- reduce [done]
- max [done]
- min [done]
- size [node]
- toArray [done]
- groupBy [done]
- sortBy [done]
- shuffle [done]
- all [done]
- any [done]
- pluck [done]
- contains [done]
- invoke [done]
- reject [done]
- Arrays [done]
- first [done]
- initial [done]
- rest [done]
- last [done]
- pack [done]
- flatten [done]
- without [done]
- unique [done]
- union [done]
- difference [done]
- zip [done]
- intersection [done]
- range [done]
- indexOf [done]
- Functions [done]
- cache [done]
- once [done]
- wrap [done]
- after [done]
- compose [done]
- Objects [done]
- keys [done]
- values [done]
- copy [done]
- extend [done]
- defaults [done]
- methods [done]
- apply [done]
- has [done]
- isEqual [done]
- isEmpty [done]
- isObject [done]
- isArray [done]
- isTraversable [done]
- isFunction [done]
- isString [done]
- isNumber [done]
- isBoolean [done]
- isDate [done]
- isNull [done]
- Utilities [done]
- with [done]
- times [done]
- id [done]
- escape [done]
License
Belt is licensed under the MIT license.
h-util/belt 适用场景与选型建议
h-util/belt 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 07 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「collections」 「php」 「tools」 「utilities」 「arrays」 「objects」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 h-util/belt 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 h-util/belt 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 h-util/belt 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
A Laravel package to retrieve data from Google Search Console
This package provides type-safe extension of the laravel collection, forcing a single type of object.
Doctrine Collections adapter for Rekapager pagination library
Library to mimics generic collections
GHT D-Tools Bundle
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-22