PHP 代码生成器,风格类似于 lombok
0.1
2015-08-07 19:14 UTC
Requires
- andrewsville/php-token-reflection: 1.*
- doctrine/annotations: ^1.2
- nikic/php-parser: 1.*
- symfony/console: ~2.3
- symfony/finder: ~2.1
Requires (Dev)
- behat/behat: 3.*
- phpspec/phpspec: ^2.2
- phpunit/phpunit: ^4.7
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-09-20 21:28:18 UTC
README
安装
$ composer require ytake/lom --dev
用法
生成命令
$ vendor/bin/lom generate [scan target dir]
特性
##@数据注解
use Ytake\Lom\Meta\Data; /** * Class DataAnnotation * @Data */ class DataAnnotation { /** * @var string $message */ protected $message; /** * @var string $testing */ protected $testing; }
after
use Ytake\Lom\Meta\Data; /** * Class DataAnnotation * @Data */ class DataAnnotation { /** * @var string $message */ protected $message; public function getMessage() { return $this->message; } public function setMessage($message) { $this->message = $message; } }
##@无参构造器注解
use Ytake\Lom\Meta\NoArgsConstructor; /** * Class DataAnnotation * @NoArgsConstructor */ class DataAnnotation { public function __construct($message) { $this->message = $message; } }
after
use Ytake\Lom\Meta\NoArgsConstructor; /** * Class DataAnnotation * @NoArgsConstructor */ class DataAnnotation { }
##@全参构造器注解
use Ytake\Lom\Meta\AllArgsConstructor; /** * Class DataAnnotation * @AllArgsConstructor */ class DataAnnotation { protected $arg1; protected $arg2; }
after
use Ytake\Lom\Meta\AllArgsConstructor; /** * Class DataAnnotation * @AllArgsConstructor */ class DataAnnotation { protected $arg1; protected $arg2; public function __construct($arg1, $arg2) { $this->arg1 = $arg1; $this->arg2 = $arg2; } }
##@getter/@setter 注解
##@value 注解