Library provides setters and getters functionality without implementing them
This library provides functionality to access the class property with setter and getter functions call without implementing them.
Use the package manager composer to install The-Magic-DTO.
composer require akef/the-magic-dto:dev-master
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();
}
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!
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.