k-hei/lombok-like 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

k-hei/lombok-like

Composer 安装命令:

composer require k-hei/lombok-like

包简介

Automatic get and set using native function __call

README 文档

README

You don't need create all getters and setters in your class. Only create attributes extends lombok-like and comment it for display in your IDE autocomplete.

Version

@2.1.0 - Throw an exception.

@2.0.0 - Removed abstract methods and change reflection to closure.

@1.2.1 - Change name of methods from __get to get for override.

@1.2.0 - Remove support to codes with underscore and improve to use private attributes.

@1.1.0 - Adaptated to old codes which were used with underscore before name of attribute.

Getting Started

composer install

composer require k-hei/lombok-like

Test Tutorial

Include LombokLike class where you need:

include 'vendor/autoload.php';

Extend it on all classes that you need:

class Test extends \LombokLike\BaseEntity {}

If you want methods can be displayed in your IDE, use the PHPdoc on attributes:

class Test extends \LombokLike\BaseEntity {
    ...
    /**
     * @method typeOfReturn getNameOfAttribute() optionally description
     * @method typeOfReturn setNameOfAttribute($value) optionally description
     */
    protected $nameOfAttribute;
    ...
}

And use!

$test = new Test();
$test->setNameOfAttribute("Test");
echo $test->getNameOfAttribute();
//Result display is: Test

If you call a unknown method, receive a LombokException:

$test->setUnknowAttr("Unkmow property");
  
Fatal error: Uncaught Call to undefined function: setUnknowAttr() In: F:\...\file.php On line: 99 
thrown in F:\...\LombokLike\entity\Base.php on line 100

Author

The LombokLike is created and maintained by Khwesten Heiner. Heiner is a senior FullStack web developer at MeuTutor and TeckS.

License

The LombokLike is released under the MIT public license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固