承接 rumd3x/php-baseobject 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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}";

统计信息

  • 总下载量: 372
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固