PHPackages                             hkwak/phpgen - 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. hkwak/phpgen

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

hkwak/phpgen
============

PHP Generator

1.4.1(6y ago)146.6k↓41.5%2PHPPHP &gt;=7.0CI failing

Since Feb 18Pushed 6y ago2 watchersCompare

[ Source](https://github.com/hkwak/phpgen)[ Packagist](https://packagist.org/packages/hkwak/phpgen)[ RSS](/packages/hkwak-phpgen/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (13)Used By (0)

PHPGen
======

[](#phpgen)

### Installation

[](#installation)

```
composer require hkwak/phpgen
```

### Usage example

[](#usage-example)

```
// 1. Creating some properties

$nameProperty = (new PropertyModel('name', 'string', AccessEnum::PROTECTED()))
    ->setDescription('The name of something')
    ->setDefaultValue('Default name');

$dobProperty = new PropertyModel('dob', 'string', AccessEnum::PROTECTED());

// 2. Creating the public setName method

// initializing the method body
$methodBody = '$this->name = $name;';

$setNameMethod =(new MethodModel('setName'))
    ->setAccess(AccessEnum::PUBLIC())
    ->setDescription('This is a method description')
    ->setReturn('self')
    ->addParameter(new ParameterModel('name', 'string'))
    ->addThrows(InvalidArgumentException::class)
    ->setBody($methodBody);

$classModel = (new ClassModel('TestClass'))
    ->addTrait(SomeTrait::class)
    ->addProperty($nameProperty)
    ->addProperty($dobProperty)
    ->addMethod($setNameMethod)
    ->addAnnotation('some Class Annotation')
    ->setDescription('This is a description of the class')
    ->setNamespace('\\Some\Namespace\\')
    ->addUse('\\Some\\Namespace\\Class')
    ->addUse('\\Some\\Namespace\\Class2')
    ->setExtends('\\Some\\Namespace\\BaseClass');

// generating the code
$classGenerator = new ClassGenerator(
            new MethodGenerator(),
            new PropertyGenerator(),
            new NamespaceManager()
        );

$classCode = $classGenerator->generate($classModel, new PhpCodeStream());
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 62.5% 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 ~10 days

Recently: every ~27 days

Total

12

Last Release

2537d ago

Major Versions

v0.2 → v1.02019-02-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6288972?v=4)[hkwak](/maintainers/hkwak)[@hkwak](https://github.com/hkwak)

---

Top Contributors

[![hkwak](https://avatars.githubusercontent.com/u/6288972?v=4)](https://github.com/hkwak "hkwak (5 commits)")[![antriver](https://avatars.githubusercontent.com/u/251159?v=4)](https://github.com/antriver "antriver (2 commits)")[![rquadling](https://avatars.githubusercontent.com/u/12801?v=4)](https://github.com/rquadling "rquadling (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hkwak-phpgen/health.svg)

```
[![Health](https://phpackages.com/badges/hkwak-phpgen/health.svg)](https://phpackages.com/packages/hkwak-phpgen)
```

###  Alternatives

[icecave/duct

An incremental streaming JSON parser.

773.5k1](/packages/icecave-duct)[adigital/gdprdatachecker

Run through the database and pull out any information associated with a specified email address

151.0k](/packages/adigital-gdprdatachecker)

PHPackages © 2026

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