项目作者: mohamed-akef

项目描述 :
Library provides setters and getters functionality without implementing them
高级语言: PHP
项目地址: git://github.com/mohamed-akef/The-Magic-DTO.git
创建时间: 2020-05-28T19:56:01Z
项目社区:https://github.com/mohamed-akef/The-Magic-DTO

开源协议:MIT License

下载


The Magic DTO

This library provides functionality to access the class property with setter and getter functions call without implementing them.

Installation

Use the package manager composer to install The-Magic-DTO.

  1. composer require akef/the-magic-dto:dev-master

Usage

just you need to use this trait in your class:

  1. use \Akef\MDTO\SetAndGetProvider;

or call The magic class in your class __call magic function like:

  1. public function __call($name, $arguments)
  2. {
  3. return (new \Akef\MDTO\MagicManager())->init($this, $name, $arguments)->run();
  4. }

Example

  1. require 'vendor/autoload.php';
  2. class Test
  3. {
  4. use \Akef\MDTO\SetAndGetProvider;
  5. private $foo;
  6. }
  7. $testObject = new Test();
  8. $test->setFoo('It is working!');
  9. $fooValue = $testObject->getFoo();
  10. echo $fooValue; //It is working!

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update the tests as appropriate.

License

MIT