eden/array
Composer 安装命令:
composer require eden/array
包简介
Autoloading, error and exception handler
README 文档
README
- Install
- Introduction
- API
- arsort
- asort
- changeKeyCase
- chunk
- combine
- count
- countValues
- diff
- diffAssoc
- diffKey
- diffUassoc
- diffUkey
- fill
- fillKeys
- filter
- flip
- implode
- inArray
- intersect
- intersectAssoc
- intersectKey
- intersectUassoc
- intersectUkey
- keys
- krsort
- ksort
- map
- merge
- mergeRecursive
- natcasesort
- natsort
- pad
- pop
- push
- reverse
- rsort
- search
- shift
- shuffle
- sizeof
- slice
- sort
- splice
- sum
- uasort
- udiff
- udiffAssoc
- udiffUassoc
- uintersect
- uintersectAssoc
- uintersectUassoc
- uksort
- unique
- unshift
- usort
- values
- walk
- walkRecursive
- Contributing
====
Install
composer install eden/array
====
Enable Eden
The following documentation uses eden() in its example reference. Enabling this function requires an extra step as descirbed in this section which is not required if you access this package using the following.
Eden_Array_Index::i();
When using composer, there is not an easy way to access functions from packages. As a workaround, adding this constant in your code will allow eden() to be available after.
Eden::DECORATOR;
For example:
Eden::DECORATOR;
eden()->inspect('Hello World');
====
Introduction
Chainable array methods. When using multiple PHP array functions in one line, it makes code harder to read. This is because a programmer needs to be trained to read code from inner to outer, rather than traditionally left to right (unless you live in Japan). Eden's data typing are objects that correct this readability problem.
array_keys(array_reverse(array_flip(array(4, 5, 6)))); // [6, 5, 4]
The above demonstrates that we must read this as array_flip(), then array_reverse(), followed by array_keys() which is inner function first going outwards. The example below shows how using types makes this line easier to read.
echo eden('array')->set(4, 5, 6)->flip()->reverse()->keys(); //--> [6, 5, 4]
When echoed the array object will automatically convert to a readable json. Eden covers most of the array functions provided by PHP. Below is a list of string methods you can linearly perform.
echo eden('array')
->set(4, 5, 6)
->flip()
->reverse()
->keys(); //--> [6, 5, 4]
Expressed vertically as above shows something more pleasing to a developer. Array objects, for the most part, can also be treated as regular arrays as implied below.
//instantiate
$array = eden('array')->set(1, 2, 3);
//push in a new value
$array[] = 4;
echo $array[1]; //--> 2
foreach($array as $key => $value) {} //loop through array
====
API
====
addslashes
Same as PHP: addslashes
Usage
eden('string')->addslashes();
Example
eden('string')->set('Hello')->addslashes();
====
bin2hex
Same as PHP: bin2hex
Usage
eden('string')->bin2hex();
Example
eden('string')->set('Hello')->bin2hex();
====
chunkSplit
Same as PHP: chunk_split
Usage
eden('string')->chunkSplit();
Example
eden('string')->set('Hello')->chunkSplit();
====
convertUudecode
Same as PHP: convert_uudecode
Usage
eden('string')->convertUudecode();
Example
eden('string')->set('Hello')->convertUudecode();
====
convertUuencode
Same as PHP: convert_uuencode
Usage
eden('string')->convertUuencode();
Example
eden('string')->set('Hello')->convertUuencode();
====
countChars
Same as PHP: count_chars
Usage
eden('string')->countChars();
Example
eden('string')->set('Hello')->countChars();
====
crypt
Same as PHP: crypt
Usage
eden('string')->crypt();
Example
eden('string')->set('Hello')->crypt();
====
explode
Same as PHP: explode
Usage
eden('string')->explode();
Example
eden('string')->set('Hello')->explode();
====
hex2bin
Same as PHP: hex2bin
Usage
eden('string')->hex2bin();
Example
eden('string')->set('Hello')->hex2bin();
====
htmlEntityDecode
Same as PHP: html_entity_decode
Usage
eden('string')->htmlEntityDecode();
Example
eden('string')->set('Hello')->htmlEntityDecode();
====
htmlentities
Same as PHP: htmlentities
Usage
eden('string')->htmlentities();
Example
eden('string')->set('Hello')->htmlentities();
====
htmlspecialchars
Same as PHP: htmlspecialchars
Usage
eden('string')->htmlspecialchars();
Example
eden('string')->set('Hello')->htmlspecialchars();
====
htmlspecialcharsDecode
Same as PHP: htmlspecialchars_decode
Usage
eden('string')->htmlspecialcharsDecode();
Example
eden('string')->set('Hello')->htmlspecialcharsDecode();
====
ipTags
Same as PHP: strip_tags
Usage
eden('string')->ipTags();
Example
eden('string')->set('Hello')->ipTags();
====
ipcslashes
Same as PHP: stripcslashes
Usage
eden('string')->ipcslashes();
Example
eden('string')->set('Hello')->ipcslashes();
====
ipslashes
Same as PHP: stripslashes
Usage
eden('string')->ipslashes();
Example
eden('string')->set('Hello')->ipslashes();
====
ireplace
Same as PHP: str_ireplace
Usage
eden('string')->ireplace();
Example
eden('string')->set('Hello')->ireplace();
====
istr
Same as PHP: stristr
Usage
eden('string')->istr();
Example
eden('string')->set('Hello')->istr();
====
lcfirst
Same as PHP: lcfirst
Usage
eden('string')->lcfirst();
Example
eden('string')->set('Hello')->lcfirst();
====
len
Same as PHP: strlen
Usage
eden('string')->len();
Example
eden('string')->set('Hello')->len();
====
ltrim
Same as PHP: ltrim
Usage
eden('string')->ltrim();
Example
eden('string')->set('Hello')->ltrim();
====
md5
Same as PHP: md5
Usage
eden('string')->md5();
Example
eden('string')->set('Hello')->md5();
====
nl2br
Same as PHP: nl2br
Usage
eden('string')->nl2br();
Example
eden('string')->set('Hello')->nl2br();
====
pad
Same as PHP: str_pad
Usage
eden('string')->pad();
Example
eden('string')->set('Hello')->pad();
====
pbrk
Same as PHP: strpbrk
Usage
eden('string')->pbrk();
Example
eden('string')->set('Hello')->pbrk();
====
pos
Same as PHP: strpos
Usage
eden('string')->pos();
Example
eden('string')->set('Hello')->pos();
====
pregReplace
Same as PHP: preg_replace
Usage
eden('string')->pregReplace();
Example
eden('string')->set('Hello')->pregReplace();
====
quotedPrintableDecode
Same as PHP: quoted_printable_decode
Usage
eden('string')->quotedPrintableDecode();
Example
eden('string')->set('Hello')->quotedPrintableDecode();
====
quotedPrintableEncode
Same as PHP: quoted_printable_encode
Usage
eden('string')->quotedPrintableEncode();
Example
eden('string')->set('Hello')->quotedPrintableEncode();
====
quotemeta
Same as PHP: quotemeta
Usage
eden('string')->quotemeta();
Example
eden('string')->set('Hello')->quotemeta();
====
repeat
Same as PHP: str_repeat
Usage
eden('string')->repeat();
Example
eden('string')->set('Hello')->repeat();
====
replace
Same as PHP: str_replace
Usage
eden('string')->replace();
Example
eden('string')->set('Hello')->replace();
====
rev
Same as PHP: strrev
Usage
eden('string')->rev();
Example
eden('string')->set('Hello')->rev();
====
rot13
Same as PHP: str_rot13
Usage
eden('string')->rot13();
Example
eden('string')->set('Hello')->rot13();
====
rtrim
Same as PHP: rtrim
Usage
eden('string')->rtrim();
Example
eden('string')->set('Hello')->rtrim();
====
sha1
Same as PHP: sha1
Usage
eden('string')->sha1();
Example
eden('string')->set('Hello')->sha1();
====
shuffle
Same as PHP: str_shuffle
Usage
eden('string')->shuffle();
Example
eden('string')->set('Hello')->shuffle();
====
sprintf
Same as PHP: sprintf
Usage
eden('string')->sprintf();
Example
eden('string')->set('Hello')->sprintf();
====
str
Same as PHP: strstr
Usage
eden('string')->str();
Example
eden('string')->set('Hello')->str();
====
substr
Same as PHP: substr
Usage
eden('string')->substr();
Example
eden('string')->set('Hello')->substr();
====
substrCompare
Same as PHP: substr_compare
Usage
eden('string')->substrCompare();
Example
eden('string')->set('Hello')->substrCompare();
====
substrCount
Same as PHP: substr_count
Usage
eden('string')->substrCount();
Example
eden('string')->set('Hello')->substrCount();
====
substrReplace
Same as PHP: substr_replace
Usage
eden('string')->substrReplace();
Example
eden('string')->set('Hello')->substrReplace();
====
tok
Same as PHP: strtok
Usage
eden('string')->tok();
Example
eden('string')->set('Hello')->tok();
====
tolower
Same as PHP: strtolower
Usage
eden('string')->tolower();
Example
eden('string')->set('Hello')->tolower();
====
toupper
Same as PHP: strtoupper
Usage
eden('string')->toupper();
Example
eden('string')->set('Hello')->toupper();
====
tr
Same as PHP: strtr
Usage
eden('string')->tr();
Example
eden('string')->set('Hello')->tr();
====
trim
Same as PHP: trim
Usage
eden('string')->trim();
Example
eden('string')->set('Hello')->trim();
====
ucfirst
Same as PHP: ucfirst
Usage
eden('string')->ucfirst();
Example
eden('string')->set('Hello')->ucfirst();
====
ucwords
Same as PHP: ucwords
Usage
eden('string')->ucwords();
Example
eden('string')->set('Hello')->ucwords();
====
vsprintf
Same as PHP: vsprintf
Usage
eden('string')->vsprintf();
Example
eden('string')->set('Hello')->vsprintf();
====
wordwrap
Same as PHP: wordwrap
Usage
eden('string')->wordwrap();
Example
eden('string')->set('Hello')->wordwrap();
====
Contributions to Eden are following the Github work flow. Please read up before contributing.
##Setting up your machine with the Eden repository and your fork
- Fork the repository
- Fire up your local terminal create a new branch from the
v4branch of your fork with a branch name describing what your changes are. Possible branch name types:- bugfix
- feature
- improvement
- Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")
##Making pull requests
- Please ensure to run
phpunitbefore making a pull request. - Push your code to your remote forked version.
- Go back to your forked version on GitHub and submit a pull request.
- An Eden developer will review your code and merge it in when it has been classified as suitable.
eden/array 适用场景与选型建议
eden/array 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 423.69k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 09 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「library」 「eden」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 eden/array 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 eden/array 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 eden/array 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 423.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 25
- 依赖项目数: 20
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-23