PHPackages                             hussfelt/zend-model-creator-2 - 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. hussfelt/zend-model-creator-2

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

hussfelt/zend-model-creator-2
=============================

This project is created to avoid the time spent on creating Entities/Services/Mappers for ZendFramework projects. It is based on some parts of the ZF-Commons team.

83112[1 issues](https://github.com/hussfelt/Zend-Model-Creator-2/issues)[1 PRs](https://github.com/hussfelt/Zend-Model-Creator-2/pulls)PHP

Since Sep 27Pushed 13y ago3 watchersCompare

[ Source](https://github.com/hussfelt/Zend-Model-Creator-2)[ Packagist](https://packagist.org/packages/hussfelt/zend-model-creator-2)[ RSS](/packages/hussfelt-zend-model-creator-2/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Zend Model Creator 2
====================

[](#zend-model-creator-2)

Version 0.0.1 Created by Henrik Hussfelt

Introduction
------------

[](#introduction)

Zend Model Creator is a generator for quick prototyping of your Zend Project. If you are not keen on using pure ORM's like Doctrine, this might be something for you.

Out of the box, Zend Model Creator works with Zend\\Db and generates Entities, Mappers and event aware Services based on your database structure.

This project is manly used to avoid the time spent on creating models for your Zend Framework projects.

Requirements
------------

[](#requirements)

- [PHP5](https://php.net/)
- [Zend Framework 2](https://github.com/zendframework/zf2) - Not needed to generate your models
- [ZfcBase](https://github.com/ZF-Commons/ZfcBase) - Not needed to generate your models

Features / Goals
----------------

[](#features--goals)

- Generate Entities \[COMPLETE\]
- Generate Mappers \[COMPLETE\]
- Generate Event Aware Services \[COMPLETE\]
- Generate EventServices \[COMPLETE\]
- Generate Module.php \[COMPLETE\]
- Generate autoloader files \[COMPLETE\]
- Generate Add Forms \[INCOMPLETE\]
- Generate Edit Forms \[INCOMPLETE\]
- Generate FormFilters \[INCOMPLETE\]

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

[](#installation)

**Install via git**

Clone this repo `git clone git@github.com:hussfelt/Zend-Model-Creator-2.git`

cd into your directory `cd Zend-Model-Creator-2`

**Install via Composer**

Add this to your composer.json under "require": `"hussfelt/zend-model-creator-2": "dev-master"`

Run command: `php composer.phar update`

Usage
-----

[](#usage)

Cd into the directory (installed with composer): `cd vendor/hussfelt/zend-model-creator-2`

Run with php: `php zmc.php --host=[DB_HOST] --db=[DATABASE_NAME] --user=[USERNAME] --password=[PASSWORD]`

1. Move your \[NAMESPACE\] directory into the /vendor/ directory
2. Add \[NAMESPACE\] to your application.config.php:

```
return array(
    'modules' => array(
        'ZfcBase',
        '[NAMESPACE_HERE]',
        'Application',
    ),
);
```

Options
-------

[](#options)

`--without-entity=1`Will not generate entities

`--without-mapper=1`Will not generate mapper

`--without-service=1`Will not generate the services

`--without-module=1`Will not generate the Module.php file

`--without-autoloaders=1`Will not generate the autoloader files

`--without-config=1`Will not generate the config file

`--without-options=1`Will not generate the options file

`--namespace=[NAMESPACE]`Will generate your data into a given Namespace and not use ZMC2

Example usage in Controller
---------------------------

[](#example-usage-in-controller)

This will replace the IndexController.php in the [Zend Framework Skeleton application](https://github.com/zendframework/ZendSkeletonApplication). Given you have a database-table "album" in your database, this will output all records "Name" from that table.

***module/Application/src/Application/Controller/IndexController.php:***

```
