biteit/utils
Composer 安装命令:
composer require biteit/utils
包简介
Library of useful classes
README 文档
README
ArrayWalker.php - Enables access to values in multidimensional arrays without using offsetGet and checking the existence of a key.
$array = [ 'level-1' => [ 'value' => 1, 'level-2' => [ 'value' => 2 ] ] ]; $walker = \BiteIT\Utils\ArrayWalker::create($array); var_dump([ $walker->get('level-1/value'), // returns 1 $walker->get('level-1/level-2) // returns ['value' => 2] ]);
Timer - Nests traced processes and renders nested lists for better orientation.
\BiteIT\Utils\Timer::start('level-1'); // your code \BiteIT\Utils\Timer::start('level-1-1'); // your code \BiteIT\Utils\Timer::end('level-1-1'); \BiteIT\Utils\Timer::end('level-1'); // renders nested list echo \BiteIT\Utils\Timer::getInstance()->renderList();
Outputs:
<ul class="process-tree"> <li class="branch"> <span class="name">level-1 (3.0017)</span> <ul class="process-tree"> <li class="branch"> <span class="name">level-1-1 (3.0016)</span> <ul class="process-tree"> <li class="branch"> <span class="name">level-1-1-1 (1.0009)</span> </li> <li class="branch"> <span class="name">level-1-1-2 (2.0007)</span> </li> </ul> </li> </ul> </li> <li class="branch"> <span class="name">level-2 (0)</span> <ul class="process-tree"> <li class="branch"> <span class="name">level-2-1 (0)</span> </li> </ul> </li> </ul>
WebLoader - Merges, minifies, cache and renders assets. It also looks for differences in files, automatically removes old merged and creates new.
Method 1 - Standard usage
use BiteIT\Utils\WebLoader; $wl = new WebLoader(WebLoader::TYPE_CSS, __DIR__.'/assets', 'http://localhost/Utils/tests/assets'); $wl->setCache(true); $wl->setDestination(__DIR__.'/webtemp/', 'http://localhost/Utils/tests/webtemp'); $wl->addLocal('style.css'); $wl->addLocal('style-2.css'); $wl->addRemote('https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'); echo $wl->render();
Method 2 - Using WLCreator
use BiteIT\Utils\WLCreator; $wlc = new WLCreator(__DIR__.'/webtemp/', 'http://localhost/Utils/tests/webtemp', __DIR__.'/assets', 'http://localhost/Utils/tests/assets'); $wlc->setCache(true); $wl = $wlc->getCssLoader(); $wl->addLocal('style.css'); $wl->addLocal('style-2.css'); $wl->addRemote('https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'); echo $wl->render();
Outputs:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <link rel="stylesheet" href="http://yourdomain.com/path/to/webtemp/style-3edb6bee1b04609e674e3c2765aabe05-4028fdd3020be3df5cbcc95000720556.css">
WebLoader known issues:
- Assets baseUrl must be accessible trough browser for non cached webloader render. Because it will just render list of sources with timestamp at the end.
ArrayWalker known issues:
- Multidimensional OffsetGet and OffsetUnset not working. ArrayWalker was not intended to implement ArrayAccess but may be fixed soon.
biteit/utils 适用场景与选型建议
biteit/utils 是一款 基于 CSS 开发的 Composer 扩展包,目前已累计 19.93k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 05 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 biteit/utils 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 biteit/utils 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 19.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-22