PHPackages                             marijnkoesen/code-generator-bundle - 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. marijnkoesen/code-generator-bundle

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

marijnkoesen/code-generator-bundle
==================================

Code generator for PHP 5.3

0.1.1(12y ago)016.2k1MITCSSPHP &gt;=5.3.0

Since Mar 5Pushed 12y ago1 watchersCompare

[ Source](https://github.com/MarijnKoesen/code-generator-bundle)[ Packagist](https://packagist.org/packages/marijnkoesen/code-generator-bundle)[ Docs](http://github.com/MarijnKoesen/code-generator-bundle)[ RSS](/packages/marijnkoesen-code-generator-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

MarijnKoesenCodeGeneratorBundle
===============================

[](#marijnkoesencodegeneratorbundle)

The **MarijnKoesenCodeGenerator** bundle allows you to generate php code for classes.

This project is based upon the [php-code-generator](https://github.com/MarijnKoesen/php-code-genereator) project and relies on the [Symfony2](http://symfony.com/) framework. If you don't have Symfony2 take a look at the php-code-generator project that you can install standalone.

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

[](#installation)

Include the bundle using composer:

```
  "require-dev": {
    "marijnkoesen/code-generator-bundle": "~0.1.0",
  }

```

Then update your composer:

```
$ composer update

```

Register the bundle in `app_kernel.php`

```
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    $bundles[] = new MarijnKoesen\CodeGeneratorBundle\MarijnKoesenCodeGeneratorBundle();
}

```

Include the routes in `routing_dev.yml`:

```
MarijnKoesenCodeGeneratorBundle:
    resource: "@MarijnKoesenCodeGeneratorBundle/Resources/config/routing.yml"
    prefix:   /code-generator

```

Install the assets:

```
$ ./app/console assets:install

```

Open your browser and go to the `http://your-project/code-generator/` URL.

Configuration
-------------

[](#configuration)

You can add your own modules, or disable the default ones with the config.

For info on how to create your own modules, see below.

```
marijn_koesen_code_generator:
    # Add your own custom modules
    modules:
        My\NameSpace\CodeGenerators\MyCustomGenerator: true

    # Disable a default generator
    defaultModules:
        codegenerator\generator\MockGenerator: false

```

Extending the code generator
----------------------------

[](#extending-the-code-generator)

You can easily create your own code generator if you want to generate anything else from your class definition.

You can extend the AbstractGenerator class, and easily create your own implementation.

See below for a sample Generator:

```
