hktr92/oopize
Composer 安装命令:
composer require hktr92/oopize
包简介
Make PHP a more OOP-friendly place.
README 文档
README
This project is about making PHP more OOP-friendly place.
Imagine this: you're developing an enterprise application with Symfony and everything looks fancy and stuff...
...until you have to use explode() to split a string by a delimiter. Or to boilerplate your code with checks if a JSON
is parsed without errors (ante-PHP 7.3). Or to make sure a string is not empty.
PHP by default does not provide OOP support for scalar types, so you won't be able to do $var = "foo"; $var->empty();
to soon (even if there there is an RFC about this).
About stability
Given it's early stage, it's difficult to maintain versions. The initial idea was:
- 0.x.y version is to represent API version. When this lib will be mostly completed, 1.x.y will be released with major improvements, stability and more secure.
- x.0.y version is to represent feature class, e.g. 0.1.0 - StringUtil, 0.2.0 - added ClassUtil, etc.
- x.y.0 version is to represent feature class improvements, e.g. 0.1.1 - StringUtil fixes, 0.2.1 - ClassUtil new feature
But this is absurd to have. Sure, latest version should always have latest version from every util class. But the oldest will always be the more mature one.
And increasing the version tag after EACH commit is insanely difficult to maintain and manually do.
Given this, I recommend to always use dev-master, as it is always the latest version and contains the latest
features and fixes.
No, I won't BC stuff, v1.0.0 is happening on another branch and php-ext-oopize is happening on another repo. (Yes, I
started to rewrite these features in zephir.)
And this happens because of two things:
- this is how this project came to life (
StringUtil,NumberUtilandClassUtilwere written for one of my project) - this is how and why I maintain, extend and improve this project.
Structure
Inside Util directory, there are defined various functionality. The implementation vary, as it can be either partially
or fully static methods.
For example, StringUtil has fully static, while ArrayUtil is
partially static (as you can use $foo = new ArrayUtil;)
Inside Traits directory, you'll have traits that is targeted for class usage.
E.g. instead of calling ClassUtil::callGetter($this, 'foo'); you can call $this->callGetter('foo');.
PHP Extension
As mentioned earlier, I've started to play around with Zephir. This means that this library will be available as a PHP extension (in order to better handle memory consumption), but a PHP polyfill will be released too, based on generated IDE stubs.
hktr92/oopize 适用场景与选型建议
hktr92/oopize 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.62k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 02 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hktr92/oopize 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hktr92/oopize 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-12