PHPackages                             nexus4812/php-class-gen - 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. nexus4812/php-class-gen

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

nexus4812/php-class-gen
=======================

PHP code generator for repositories, entities, and tests with DSL support

v0.0.3(6mo ago)11MITPHPPHP ^8.2CI passing

Since Oct 12Pushed 6mo agoCompare

[ Source](https://github.com/nexus4812/php-class-gen)[ Packagist](https://packagist.org/packages/nexus4812/php-class-gen)[ RSS](/packages/nexus4812-php-class-gen/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (5)Used By (0)

**This project is currently in draft stage**

Breaking changes may occur until the official release.

PHP Class Generator
===================

[](#php-class-generator)

[日本語](document/README_JA.md) | [English](README.md)

A powerful and flexible PHP code generation library. Create custom code generators easily with a command-based architecture. Perfect for generating boilerplate code, CQRS patterns, domain objects, and more.

Features
--------

[](#features)

### nette/php-generator Extensions

[](#nettephp-generator-extensions)

- Built on [nette/php-generator](https://github.com/nette/php-generator) with additional convenient features for basic code generation:
- **Automatic Use Statement Generation**: Automatically adds import statements for used classes
- **Auto Strict Types**: Automatically inserts `declare(strict_types=1);`
- **PSR-4 Auto Mapping**: Reads composer.json configuration to automatically map namespaces to file paths
- **Automatic Dependency Resolution**: Analyzes class dependencies and auto-generates required use statements
- **Command-Based Architecture**: Easily create and manage reusable code generation commands

CLI is built on [symfony/console](https://github.com/symfony/console).

### MCP (Model Context Protocol) Support

[](#mcp-model-context-protocol-support)

Integrates with Claude Code/Claude Desktop for AI-assisted code generation:

- Automatically exposes Symfony commands as MCP tools
- Execute code generation commands directly from prompts
- Project-specific code generation available from AI assistants

### Installation

[](#installation)

```
composer require --dev nexus4812/php-class-gen
```

Quick Start
-----------

[](#quick-start)

### 1. Create Configuration File

[](#1-create-configuration-file)

Create `phpgen.php` in your project root:

```
