PHPackages                             igniphp/reflection-api - 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. igniphp/reflection-api

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

igniphp/reflection-api
======================

1.0.2(8y ago)11741MITPHPPHP ^7.1.0

Since May 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/igniphp/reflection-api)[ Packagist](https://packagist.org/packages/igniphp/reflection-api)[ RSS](/packages/igniphp-reflection-api/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (1)

[![Igni logo](https://github.com/igniphp/common/raw/master/logo/full.svg)](https://github.com/igniphp/common/blob/master/logo/full.svg)
=======================================================================================================================================

[](#)

[![Build Status](https://camo.githubusercontent.com/85530958ac2cb765c3c6a4a30edabbb17846b6affeacd0201a41f54c88d6f20e/68747470733a2f2f7472617669732d63692e6f72672f69676e697068702f7265666c656374696f6e2d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/igniphp/reflection-api)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/22432ce8eb41576332b8cb0749aef25585ac7134cca6411efc7218fa3481fdda/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69676e697068702f7265666c656374696f6e2d6170692f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/igniphp/reflection-api/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/96de1f6adeb2d788e956cd3fdb3813c3e76ab97bb9c8c98c7cb24498bb5544c8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69676e697068702f7265666c656374696f6e2d6170692f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/igniphp/reflection-api/?branch=master)

Installation
------------

[](#installation)

```
composer require igniphp/reflection-api

```

Reflection API
--------------

[](#reflection-api)

Licensed under MIT License.

Reflection api provides tools that allows to:

- read and write object's properties
- build classes on runtime
- retrieves closure's body
- instantiating objects without reflection api

### Reading object's properties

[](#reading-objects-properties)

```
use Igni\Utils\ReflectionApi;

class TestClass
{
    private $test;

    public function __construct()
    {
        $this->test = 1;
    }
}

$instance = new TestClass();

ReflectionApi::readProperty($instance, 'test');
```

### Write object's properties

[](#write-objects-properties)

```
use Igni\Utils\ReflectionApi;

class TestClass
{
    private $test;

    public function __construct()
    {
        $this->test = 1;
    }
}

$instance = new TestClass();

ReflectionApi::writeProperty($instance, 'test', 2);
```

### Create an instance

[](#create-an-instance)

```
use Igni\Utils\ReflectionApi;

class TestClass
{
    private $test;

    public function __construct()
    {
        $this->test = 1;
    }
}

$instance = ReflectionApi::createInstance(TestClass::class);
```

### Building and loading class on runtime

[](#building-and-loading-class-on-runtime)

```
use Igni\Utils\ReflectionApi;
use Igni\Utils\ReflectionApi\RuntimeProperty;
use Igni\Utils\ReflectionApi\RuntimeMethod;

$class = ReflectionApi::createClass('TestClass');

$class->addProperty((new RuntimeProperty('test))->makePrivate());

$constructor = new RuntimeMethod('__construct');
$constructor->addBody(
    '$this->test = 1'
);

$getTest = new RuntimeMethod('getTest');
$getTest->setReturnType('string');
$getTest->addBody(
    'return $this->test'
);

$class->addMethod($constructor);
$class->addMethod($getTest);

$class->load();

$instance = $class->createInstance();

$instance instanceof 'TestClass';// true.
$instance->getTest();// 1
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

2922d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/271195868939c0f91f2eaccb617a4e0967088b9e6fca0edeb305a9af394daf02?d=identicon)[dkraczkowski](/maintainers/dkraczkowski)

---

Top Contributors

[![dkraczkowski](https://avatars.githubusercontent.com/u/578333?v=4)](https://github.com/dkraczkowski "dkraczkowski (5 commits)")

---

Tags

class-builderphpreflection

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/igniphp-reflection-api/health.svg)

```
[![Health](https://phpackages.com/badges/igniphp-reflection-api/health.svg)](https://phpackages.com/packages/igniphp-reflection-api)
```

PHPackages © 2026

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