Code Metamodel for PHP, (*1)
, (*2)
Features
-
Parser\Parser parses PHP sources under a project to generate metamodel objects (via CLI command).
-
Element\* are metamodel classes. Currently supports
- [x] namespace
- [x] use
- [x] class
- [x] class annotation
- [ ] class inheritance
- [x] property
- [x] property annotation
- [ ] property type resolving (only declared by use)
- [x] method
- [x] method annotation
-
Dumper\SimpleDumper dumps metamodel objects to simple text.
Installation
CodeMetamodel-PHP can be installed using Composer., (*3)
CAUTION: dev package is only available., (*4)
// composer.json
{
"minimum-stability": "dev"
}
$ composer require domaincoder/code-metamodel-php
Commands
Some features of CodeMetamodel-PHP are provided via CLI commands. CLI commands can be ran as follows:, (*5)
$ php bin/domaincoder-parser.php COMMAND_NAME TARGET_DIR (OPTIONS)
parse
This command parses codes under the TARGET_DIR and create model cache., (*6)
$ php bin/domaincoder-parser.php parse /path/to/project/root
dump
This command dumps meta-model objects of a specified location., (*7)
$ php bin/domaincoder-parser.php dump /path/to/project/root
filter-class
With this command you can search classes in a meta-model objects of a specified location.
Options are:, (*8)
- annotation: Annotation name (ex. ORM\Entity, author)
- comment: keyword (ex. related to tax)
$ php bin/domaincoder-parser.php filter-class /path/to/project/root --annotation=Route --comment=Test
filter-property
With this command you can search properties in a meta-model objects of a specified location.
Options are:, (*9)
- annotation: Annotation name (ex. ORM\Entity, author)
- comment: keyword (ex. related to tax)
$ php bin/domaincoder-parser.php filter-property /path/to/project/root --annotation=Route --comment=Test
filter-method
With this command you can search methods in a meta-model objects of a specified location.
Options are:, (*10)
- annotation: Annotation name (ex. ORM\Entity, author)
- comment: keyword (ex. related to tax)
$ php bin/domaincoder-parser.php filter-method /path/to/project/root --annotation=Route --comment=Test
Roadmap
- v 0.0.1 implements parser which parses codes to build metamodel objects. saving model objects to a cache (APC) or json format.
- v 0.0.2 adds filter commands.
- v 0.0.3 adds modifying existing AST to add fields, change annotations, etc.
Support
If you find a bug or have a question, or want to request a feature, create an issue or pull request for it on Issues., (*11)
Copyright
Copyright (c) 2015 GOTO Hidenori, All rights reserved., (*12)
License
The BSD 2-Clause License, (*13)