cinling/ext-lib
Composer 安装命令:
composer require cinling/ext-lib
包简介
General code base for work.
README 文档
README
Install
composer require "cinling/ext-lib"
Document
- Service
- Util
- ArrayUtil
- ConsoleUtil
- CronParseUtil
- DevelUtil
- EncryptUtil
- EnvUtil
- ExcelUtil
- FileUtil
- GeoUtil
- Value Object(vo)...
- Enums...
Service
- Encapsulation of a function
- Provides configurable parameters
FileCacheService
- Save data to file
Config
| name | type | note | default |
|---|---|---|---|
| path | string | Cache file save path | ./runtime/cin-cache |
| pathDeeps | int | Path depth | 2 |
| pathUnitLen | int | The number of characters in a single directory | 2 |
Example
Set cache
use cin\extLib\services\FileCacheService; FileCacheService::getIns()->set("CacheKeyCin", "cin");
Get cache
use cin\extLib\services\FileCacheService; $srv = FileCacheService::getIns(); $srv->set("CacheKeyCin", "cin"); $value = FileCacheService::getIns()->get("CacheKeyCin"); echo $value; // output: cin
Delete cache
use cin\extLib\services\FileCacheService; $srv = FileCacheService::getIns(); $srv->set("CacheKeyCin", "cin"); $srv->del("CacheKeyCin"); $value = $srv->get("CacheKeyCin"); echo $value; // output: null
Set cache with expiration time
use cin\extLib\services\FileCacheService; FileCacheService::getIns()->set("CacheKeyCin", "cin", 3600); // expire after 3600s
LogService
- Output the log and save it in the log file
Config
| name | type | note | default |
|---|---|---|---|
| path | string | Log file save path | ./runtime/cin-log |
| fileMaxSize | string | Log file max bytes | 2MB |
Example
use cin\extLib\services\LogService; LogService::getIns()->info("Content...", "Title");
output in runtime/cin-log/cin.log:
[2021-01-18 14:54:31 INFO Title] Content...
Util
- Provides encapsulation of static methods
- It can be inserted by
trait
ArrayUtil
toArray($attrs): array
Convert $attrs to an array。
$attrs can be an array, an object, a BaseVo derived class, or any collation of the above
cinling/ext-lib 适用场景与选型建议
cinling/ext-lib 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 01 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cinling/ext-lib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cinling/ext-lib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-10