gree / MagicSpice

MIT License
26 stars 4 forks source link

What is MagicSpice

MagicSpice is a class utility similar to Lombok. It provides simple definitions for common constructor/getters/setters. It also integrates well with many existing IDEs.

usage

define

class Employee
{
    use MagicSpice\ClassHelper, MagicSpice\ClassHelper\Accessor\Set {
        getInt         as public getId;
        getString      as public getFirstName;
        getString      as public getLastName;
        getFloatOrNull as public getYearsOfService;
        setFloatOrNull as public setYearsOfService;
    }
}

instantiate and get/set

$john = new Employee([
    'id'         => 100,
    'first_name' => 'John',
    'last_name'  => 'Doe',
]);

print $john->getFirstName() . $john->getLastName();
$john->setYearsOfService(2.5);
print $john->getYearsOfService();

IDE-friendly

supported

not supported

known problems