akef / the-magic-dto
The Magic DTO
dev-master
2020-06-25 07:48 UTC
Requires
- php: ^7.0
This package is auto-updated.
Last update: 2024-09-25 17:05:32 UTC
README
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.
composer require akef/the-magic-dto:dev-master
Usage
just you need to use this trait in your class:
use \Akef\MDTO\SetAndGetProvider;
or call The magic class in your class __call
magic function like:
public function __call($name, $arguments) { return (new \Akef\MDTO\MagicManager())->init($this, $name, $arguments)->run(); }
Example
require 'vendor/autoload.php'; class Test { use \Akef\MDTO\SetAndGetProvider; private $foo; } $testObject = new Test(); $test->setFoo('It is working!'); $fooValue = $testObject->getFoo(); 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.