PHPackages                             domaincoder/code-metamodel-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. domaincoder/code-metamodel-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

domaincoder/code-metamodel-php
==============================

CodeMetamodel-PHP provides metamodel classes of PHP code and a parser which parses PHP codes and build metamodel objects.

019[1 issues](https://github.com/domaincoder/code-metamodel-php/issues)PHP

Since Mar 26Pushed 11y ago2 watchersCompare

[ Source](https://github.com/domaincoder/code-metamodel-php)[ Packagist](https://packagist.org/packages/domaincoder/code-metamodel-php)[ RSS](/packages/domaincoder-code-metamodel-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

\[WIP\] CodeMetamodel-PHP
=========================

[](#wip-codemetamodel-php)

Code Metamodel for PHP

[![Build Status](https://camo.githubusercontent.com/2e11450747b74465b45575c3275a4202973974f6f83c54d54d582cfebf91334b/68747470733a2f2f7472617669732d63692e6f72672f646f6d61696e636f6465722f636f64652d6d6574616d6f64656c2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/domaincoder/code-metamodel-php)[![SensioLabsInsight](https://camo.githubusercontent.com/23723bbdb76b223f1680dbdee666a1d036c9b70bd8eb606e8d4087696816bf16/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f35633938663632322d346264662d343366382d393633612d6265376339653465336531662f6d696e692e706e67)](https://insight.sensiolabs.com/projects/5c98f622-4bdf-43f8-963a-be7c9e4e3e1f)[![Total Downloads](https://camo.githubusercontent.com/c1c09f6c5c4c2b0e28a482cec992c155d1bd4b4750c6ec9431a862f0bbc52914/68747470733a2f2f706f7365722e707567782e6f72672f646f6d61696e636f6465722f636f64652d6d6574616d6f64656c2d7068702f646f776e6c6f6164732e706e67)](https://packagist.org/packages/domaincoder/code-metamodel-php)[![Latest Stable Version](https://camo.githubusercontent.com/60e0bea8ae3794daf8e27b8e984401e4ba0fbdf09966f42c1f62f13637260466/68747470733a2f2f706f7365722e707567782e6f72672f646f6d61696e636f6465722f636f64652d6d6574616d6f64656c2d7068702f762f737461626c652e706e67)](https://packagist.org/packages/domaincoder/code-metamodel-php)[![Latest Unstable Version](https://camo.githubusercontent.com/f9e51349c68cf2214818e929016afccf6526621d641b5c35435fae8b50292d9d/68747470733a2f2f706f7365722e707567782e6f72672f646f6d61696e636f6465722f636f64652d6d6574616d6f64656c2d7068702f762f756e737461626c652e706e67)](https://packagist.org/packages/domaincoder/code-metamodel-php)[![Dependency Status](https://camo.githubusercontent.com/91e2f0204e9d3b36cfa52e4eeb8378bd849ba267a6c9c3cb094677aeb66947da/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f646f6d61696e636f6465723a636f64652d6d6574616d6f64656c2d7068702f6465762d6d61737465722f62616467652e737667)](https://www.versioneye.com/php/domaincoder:code-metamodel-php/dev-master)

Features
--------

[](#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
------------

[](#installation)

`CodeMetamodel-PHP` can be installed using [Composer](http://getcomposer.org/).

CAUTION: dev package is only available.

```
// composer.json
{
    "minimum-stability": "dev"
}

$ composer require domaincoder/code-metamodel-php

```

Commands
--------

[](#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

[](#parse)

This command parses codes under the TARGET\_DIR and create model cache.

```
$ php bin/domaincoder-parser.php parse /path/to/project/root

```

### dump

[](#dump)

This command dumps meta-model objects of a specified location.

```
$ php bin/domaincoder-parser.php dump /path/to/project/root

```

### filter-class

[](#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

[](#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

[](#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
-------

[](#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
-------

[](#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](https://github.com/domaincoder/code-metamodel-php/issues).

Copyright
---------

[](#copyright)

Copyright (c) 2015 GOTO Hidenori, All rights reserved.

License
-------

[](#license)

[The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause)

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a68a4dab8a48ed7cea7379e065bbe9cbb2c68a6718c9d678afa8e0d261f1255?d=identicon)[hidenorigoto](/maintainers/hidenorigoto)

---

Top Contributors

[![hidenorigoto](https://avatars.githubusercontent.com/u/89830?v=4)](https://github.com/hidenorigoto "hidenorigoto (27 commits)")

### Embed Badge

![Health badge](/badges/domaincoder-code-metamodel-php/health.svg)

```
[![Health](https://phpackages.com/badges/domaincoder-code-metamodel-php/health.svg)](https://phpackages.com/packages/domaincoder-code-metamodel-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
