PHPackages                             ralfeggert/zftool - 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. ralfeggert/zftool

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

ralfeggert/zftool
=================

Fork of the official ZFTool utility module for Zend Framework 2 applications.

3601PHP

Since Dec 11Pushed 12y ago2 watchersCompare

[ Source](https://github.com/RalfEggert/ZFTool)[ Packagist](https://packagist.org/packages/ralfeggert/zftool)[ RSS](/packages/ralfeggert-zftool/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (5)Used By (0)

Zend Framework 2 Tool
=====================

[](#zend-framework-2-tool)

This is a **fork** of the official ZFTool module:

Please refer to the [Todo](#todo) for any planned features.

**ZFTool** is an utility module for maintaining modular Zend Framework 2 applications. It runs from the command line and can be installed as ZF2 module or as PHAR (see below).

Features
--------

[](#features)

- Install ZF2 library
- Listing of
    - Modules in an application
    - Controllers in a module
    - Actions in a controller
- Creation of
    - a new project (install the ZF2 skeleton application)
    - a new module
    - a new controller (optional add configuration and a factory)
    - a new action in a controller
    - a new view helper (optional add configuration and a factory)
    - basic routing for a module
- Generate classmap and change `Module.php` to use it
- [Application diagnostics](docs/DIAGNOSTICS.md)

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

[](#requirements)

- Zend Framework 2.0.0 or later.
- PHP 5.3.3 or later.
- Console access to the application being maintained (shell, command prompt)

Installation using [Composer](http://getcomposer.org)
-----------------------------------------------------

[](#installation-using-composer)

1. Open console (command prompt)
2. Go to your application's directory.
3. Run `composer require zendframework/zftool:dev-master`
4. Execute the `vendor/bin/zf.php` as reported below

Using the PHAR file (zftool.phar)
---------------------------------

[](#using-the-phar-file-zftoolphar)

1. Download the [zftool.phar from packages.zendframework.com](http://packages.zendframework.com/zftool.phar)
2. Execute the `zftool.phar` with one of the options reported below (`zftool.phar` replace the `zf.php`)

You can also generate the zftool.phar using the `bin/create-phar` command as reported below

Usage
-----

[](#usage)

### Basic information

[](#basic-information)

#### Display current Zend Framework 2 version

[](#display-current-zend-framework-2-version)

```
zf.php version []
zf.php --version []

[]            (Optional) path to a ZF2 application

```

#### Show all modules within a ZF2 application

[](#show-all-modules-within-a-zf2-application)

```
zf.php modules []

[]            (Optional) path to a ZF2 application

```

#### Show all controllers for a module

[](#show-all-controllers-for-a-module)

```
zf.php controllers  []

       Name of module
[]            (Optional) path to a ZF2 application

```

#### Show all actions for a controller in a module

[](#show-all-actions-for-a-controller-in-a-module)

```
zf.php actions   []

       Name of module
   Name of controller
[]            (Optional) path to a ZF2 application

```

### Diagnostics

[](#diagnostics)

```
zf.php diag [] [options]

[] (Optional) name of module to test
--verbose | -v      Display detailed information.
--break   | -b      Stop testing on first failure.
--quiet   | -q      Do not display any output unless an error occurs.
--debug   | -d      Display raw debug info from tests.

```

### Creation

[](#creation)

#### Project creation

[](#project-creation)

```
zf.php create project

              Path of the project to be created

```

#### Module creation

[](#module-creation)

```
zf.php create module  [] [options]

       Name of module to be created
[]            (Optional) path to a ZF2 application
--ignore  | -i      Ignore coding conventions
--apidocs | -a      Prevent the api doc block generation

```

#### Controller creation:

[](#controller-creation)

```
zf.php create controller   [] [options]

   Name of controller to be created
       Module in which controller should be created
[]            (Optional) path to a ZF2 application
--factory | -f      Create a factory for the controller
--ignore  | -i      Ignore coding conventions
--config  | -c      Prevent that module configuration is updated
--apidocs | -a      Prevent the api doc block generation

```

#### Action creation:

[](#action-creation)

```
zf.php create action    [] [options]

       Name of action to be created
   Name of controller in which action should be created
       Module containing the controller
[]            (Optional) path to a ZF2 application
--ignore  | -i      Ignore coding conventions
--apidocs | -a      Prevent the api doc block generation

```

#### Routing creation:

[](#routing-creation)

```
zf.php create routing  [] [options]

       Name of module to create the routing for
[]            (Optional) path to a ZF2 application
--single  | -s      Create single standard route for the module

```

#### View helper creation:

[](#view-helper-creation)

```
zf.php create view-helper   [] [options]

       Name of view helper to be created
       Module in which view helper should be created
[]            (Optional) path to a ZF2 application
--factory | -f      Create a factory for the view helper
--ignore  | -i      Ignore coding conventions
--config  | -c      Prevent that module configuration is updated
--apidocs | -a      Prevent the api doc block generation

```

### Application configuration

[](#application-configuration)

#### List all configuration option

[](#list-all-configuration-option)

```
zf.php config list [] [options]

[]            (Optional) path to a ZF2 application
--local   | -l      Use local configuration file

```

#### Display a single config value

[](#display-a-single-config-value)

```
zf.php config get  [] [options]

       Configuration key, i.e. db.host
[]            (Optional) path to a ZF2 application
--local   | -l      Use local configuration file

```

#### Set a single config value (to change scalar values in local configuration file)

[](#set-a-single-config-value-to-change-scalar-values-in-local-configuration-file)

```
zf.php config set   []

       Configuration key, i.e. db.host
      Configuration value, i.e. localhost
[]            (Optional) path to a ZF2 application

```

### Generate a Classmap for a directory / module

[](#generate-a-classmap-for-a-directory--module)

```
zf.php generate classmap  []

         Directory to scan for PHP classes (use "." to use current directory)
[]     (Optional) File name for class map file or - for standard output.
                    Defaults to autoload_classmap.php inside .

```

### ZF library installation

[](#zf-library-installation)

```
zf.php install  []

              Path where to install the ZF2 library
[]         (Optional) Version to install, defaults to the last version available

```

### Compile the PHAR file

[](#compile-the-phar-file)

You can create a .phar file containing the ZFTool project. In order to compile ZFTool in a .phar file you need to execute the following command:

```
bin/create-phar

```

This command will create a *zftool.phar* file in the bin folder. You can use and ship only this file to execute all the ZFTool functionalities. After the *zftool.phar* creation, we suggest to add the folder bin of ZFTool in your PATH environment. In this way you can execute the *zftool.phar* script wherever you are, for instance executing the command:

```
mv zftool.phar /usr/local/bin/zftool.phar

```

Note: If the above fails due to permissions, run the mv line again with sudo.

Todo
----

[](#todo)

- Generate all code with `Zend\Code` \[DONE\]
- Make doc block generation optional \[DONE\]
- Add basic routing (optional) \[DONE\]
- Create Configurator class for configuration changes \[DONE\]
- Create plugin for manipulating request parameters \[DONE\]
- Create Factory class for given controller \[DONE\]
- Add configuration for classmap generation \[DONE\]
- Refactor controllers \[DONE\]
- Re-organize help page \[DONE\]
- Create skeleton classes and configuration for \[IN PROGRESS\]
    - view helpers
    - controller plugins
    - forms
    - input filters
    - hydrators
- Write tests for \[NOT STARTED YET\]
    - generator
    - configurator
    - controller
    - option class
- Create skeleton configuration for \[NOT STARTED YET\]
    - `Zend\Translate`
- Application configuration \[NOT STARTED YET\]
    - Turn module caching on/off, check writable caching dir
    - Support other configuration file types beside php, e.g. ini, yaml, ....
- Add module inspections \[NOT STARTED YET\]
    - Ensuring that `Module.php` has a zero-argument constructor
    - Ensuring that `getConfig()` returns serializable config
    - Ensuring that `Module.php` does not retain global state (no statics)
    - Ensuring that config returned by `get[A-Za-z]+Config()` produces arrays compatible with `Zend\ServiceManager\Config`
- Add creation of a project (without the SkeletonApplication)
- to be continued

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/059af7cb56ad072aad516af2d3e57c4afc12a0fff370cafc612b7db8cdbe84d6?d=identicon)[Frille](/maintainers/Frille)

---

Top Contributors

[![Thinkscape](https://avatars.githubusercontent.com/u/270528?v=4)](https://github.com/Thinkscape "Thinkscape (57 commits)")[![weierophinney](https://avatars.githubusercontent.com/u/25943?v=4)](https://github.com/weierophinney "weierophinney (42 commits)")[![ezimuel](https://avatars.githubusercontent.com/u/475967?v=4)](https://github.com/ezimuel "ezimuel (39 commits)")[![Maks3w](https://avatars.githubusercontent.com/u/1301698?v=4)](https://github.com/Maks3w "Maks3w (6 commits)")[![fmarcoux96](https://avatars.githubusercontent.com/u/1487078?v=4)](https://github.com/fmarcoux96 "fmarcoux96 (5 commits)")[![adamlundrigan](https://avatars.githubusercontent.com/u/527329?v=4)](https://github.com/adamlundrigan "adamlundrigan (2 commits)")[![jrnickell](https://avatars.githubusercontent.com/u/947805?v=4)](https://github.com/jrnickell "jrnickell (2 commits)")[![nullgeraet](https://avatars.githubusercontent.com/u/1734870?v=4)](https://github.com/nullgeraet "nullgeraet (2 commits)")[![raphaeldealmeida](https://avatars.githubusercontent.com/u/235028?v=4)](https://github.com/raphaeldealmeida "raphaeldealmeida (2 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (2 commits)")[![valorin](https://avatars.githubusercontent.com/u/897369?v=4)](https://github.com/valorin "valorin (2 commits)")[![bineetchaubey](https://avatars.githubusercontent.com/u/4551052?v=4)](https://github.com/bineetchaubey "bineetchaubey (1 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (1 commits)")[![ralphschindler](https://avatars.githubusercontent.com/u/76674?v=4)](https://github.com/ralphschindler "ralphschindler (1 commits)")[![bakura10](https://avatars.githubusercontent.com/u/1198915?v=4)](https://github.com/bakura10 "bakura10 (1 commits)")[![web-axioma](https://avatars.githubusercontent.com/u/5706238?v=4)](https://github.com/web-axioma "web-axioma (1 commits)")[![goten4](https://avatars.githubusercontent.com/u/47129?v=4)](https://github.com/goten4 "goten4 (1 commits)")[![szsoftware](https://avatars.githubusercontent.com/u/2539622?v=4)](https://github.com/szsoftware "szsoftware (1 commits)")[![lukenm](https://avatars.githubusercontent.com/u/1787762?v=4)](https://github.com/lukenm "lukenm (1 commits)")[![gartner](https://avatars.githubusercontent.com/u/195601?v=4)](https://github.com/gartner "gartner (1 commits)")

### Embed Badge

![Health badge](/badges/ralfeggert-zftool/health.svg)

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

PHPackages © 2026

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