Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/class
test
.gitignore
LICENSE
README.md
build.xml
composer.json
composer.lock
phpunit.phar
phpunit.xml.dist

README.md

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

  • IDEA
  • PhpStorm
  • Eclipse PDT

not supported

  • NetBeans

known problems

  • incompatible with APC
  • incompatible with phpDocumentor2 and ApiGen
You can’t perform that action at this time.