Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gree/MagicSpice
https://github.com/gree/MagicSpice
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gree/MagicSpice
- Owner: gree
- License: mit
- Created: 2014-04-15T10:07:08.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-06T04:32:55.000Z (almost 10 years ago)
- Last Synced: 2024-05-29T08:11:47.081Z (6 months ago)
- Language: PHP
- Size: 653 KB
- Stars: 26
- Watchers: 12
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# What is MagicSpice
MagicSpice is a class utility similar to [Lombok](http://projectlombok.org/).
It provides simple definitions for common constructor/getters/setters.
It also integrates well with many existing IDEs.## usage
### define```php
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
```php
$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