rumd3x/php-baseobject
Composer 安装命令:
composer require rumd3x/php-baseobject
包简介
A very helpful class to extend from and use as a base for other classes.
README 文档
README
A very helpful class to extend from and use as a base for other classes.
Installation
To install via composer just run
composer require rumd3x/php-baseobject
Usage
Inheriting stuff
Just make any class extending the BaseObject
use Rumd3x\BaseObject\BaseObject; class MyClass extends BaseObject { // Your class definition private $my_property; }
Automatic getters and setters
To use the automatic getters and setters, make your properties snake case, and your methods camel case.
$obj = new MyClass; $obj->my_property = 'value'; // This will automatically do $obj->setMyProperty('value'); if you have defined this method. $prop_value = $obj->my_property; // This will automatically do $prop_value = $obj->getMyProperty(); if you have defined this method.
Helpers
There are several standard helper method on the base object to help on object manipulation in addidition to the already defined php magic methods.
$obj = new MyClass; // BaseObject::parse($data) Creates a new instance base on the contents of $data. // Data can be either an object of any class, an array, a json string or a XML string. MyClass::parse($data); // Returns instance of MyClass. $obj->parse($data); // Casts $data into the already existing instance. $obj->toArray(); // Converts the object to an array. $obj->toJson(); // Converts the object to a json string representation. $obj->toXml(); // Converts the object to a XML string representation. // You can also safely use the object to along side with strings. echo $obj; $string = "my object value => {$obj}";
rumd3x/php-baseobject 适用场景与选型建议
rumd3x/php-baseobject 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 372 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「object」 「base」 「rumd3x」 「php-baseobject」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rumd3x/php-baseobject 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rumd3x/php-baseobject 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rumd3x/php-baseobject 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
Runn Me! Value Objects Library
yii2 simialbi base
Encode integer IDs using a preset or customized symbol set
Laravel SDK mapping data in object
Yii2 js base class
统计信息
- 总下载量: 372
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-20