domaincoder / code-metamodel-php
CodeMetamodel-PHP provides metamodel classes of PHP code and a parser which parses PHP codes and build metamodel objects.
Requires
- php: >=5.5.0
- doctrine/annotations: ~1.2
- herrera-io/annotations: ~1.0
- lstrojny/functional-php: 1.0.0-alpha4
- nikic/php-parser: ~1.1.0
- phpmentors/domain-kata: ~1.3
- symfony/console: ~2.6
- symfony/finder: ~2.6
Requires (Dev)
- phake/phake: ~2.0
- phpunit/phpunit: ~4.3
This package is not auto-updated.
Last update: 2024-12-21 18:04:14 UTC
README
Code Metamodel for PHP
Features
Parser\Parser
parses PHP sources under a project to generate metamodel objects (via CLI command).Element\*
are metamodel classes. Currently supports- namespace
- use
- class
- class annotation
- class inheritance
- property
- property annotation
- property type resolving (only declared by use)
- method
- method annotation
Dumper\SimpleDumper
dumps metamodel objects to simple text.
Installation
CodeMetamodel-PHP
can be installed using Composer.
CAUTION: dev package is only available.
// 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:
$ php bin/domaincoder-parser.php COMMAND_NAME TARGET_DIR (OPTIONS)
parse
This command parses codes under the TARGET_DIR and create model cache.
$ php bin/domaincoder-parser.php parse /path/to/project/root
dump
This command dumps meta-model objects of a specified location.
$ 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:
- 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:
- 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:
- 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.
Copyright
Copyright (c) 2015 GOTO Hidenori, All rights reserved.