PHPackages                             divix1988/laminas-cli-commands - 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. [CLI &amp; Console](/categories/cli)
4. /
5. divix1988/laminas-cli-commands

ActiveLibrary[CLI &amp; Console](/categories/cli)

divix1988/laminas-cli-commands
==============================

CLI commands for Laminas projects

1.5(3y ago)181.6k↓100%4MITPHPPHP ^7.1 || ^8.1

Since Apr 25Pushed 3y ago3 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (12)Used By (0)

laminas-cli-commands
====================

[](#laminas-cli-commands)

CLI Commands for Laminas projects. *WARNING, STILL IN BETA.*

Official website:

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

[](#installation)

### Via Composer

[](#via-composer)

Install the library using [Composer](https://getcomposer.org):

```
$ composer require --dev divix1988/laminas-cli-commands
```

Setup
-----

[](#setup)

Add the following config into your `config/local.php` file:

```
'laminas-cli' => [
    'commands' => [
        'mvc:controller' => \Divix\Laminas\Cli\Command\ControllerCommand::class,
        'mvc:rowset' => \Divix\Laminas\Cli\Command\RowsetCommand::class,
        'mvc:model' => \Divix\Laminas\Cli\Command\ModelCommand::class,
        'mvc:form' => \Divix\Laminas\Cli\Command\FormCommand::class,
        'mvc:view' => \Divix\Laminas\Cli\Command\ViewCommand::class,
        'mvc:crud' => \Divix\Laminas\Cli\Command\CrudCommand::class,
        'mvc:crud_controller' => \Divix\Laminas\Cli\Command\CrudControllerCommand::class,
        'mvc:crud_view' => \Divix\Laminas\Cli\Command\CrudViewCommand::class,
        'mvc:crud_config' => \Divix\Laminas\Cli\Command\CrudConfigCommand::class,
        'mvc:login_registration' => \Divix\Laminas\Cli\Command\LoginRegistrationCommand::class,
        'mvc:admin' => \Divix\Laminas\Cli\Command\AdminPanelCommand::class,
        'mvc:navigation' => \Divix\Laminas\Cli\Command\NavigationCommand::class,
        'mvc:sitemap' => \Divix\Laminas\Cli\Command\SitemapCommand::class,
        'mvc:mariadb_database_connect' => \Divix\Laminas\Cli\Command\MariaDbCommand::class
    ],
],
```

Usage
-----

[](#usage)

```
$ vendor/bin/laminas [command-params] [command-name]
```

or for Windows users:

```
$ "vendor/bin/laminas.bat" [command-params] [command-name]
```

Available commands
------------------

[](#available-commands)

### Controller

[](#controller)

Generate sample controller with a list of available actions:

```
"vendor/bin/laminas.bat" mvc:controller --actions= --actions= --module=ModuleName
```

New file in: `[root]/module/[moduleName]/src/Controller/[name].php`

Sample output:

```
namespace ModuleName\Controller\ControllerNameController;

class ControllerNameController extends \Laminas\Mvc\Controller\AbstractActionController
{

    public function indexAction()
    {
    }

    public function action1Action()
    {
    }

    public function action2Action()
    {
    }

}
```

### Model

[](#model)

Generate sample model with a list of properties:

```
"vendor/bin/laminas.bat" mvc:model --properties= --properties= --module=ModuleName
```

New file in: `[root]/module/[moduleName]/src/Model/[name].php`

Sample output:

```
namespace ModuleName\Model;

class ModelNameTable extends AbstractTable
{

    protected $resultsPerPage = 10;

    public function getBy(array $params = [])
    {
        $select = $this->tableGateway->getSql()->select();

        if (isset($params['id'])) {
            $select->where(['id' => $params['id']]);
            $params['limit'] = 1;
        }

        if (isset($params['property1'])) {
            $select->where(['property1' => $params['property1']]);
        }

        if (isset($params['property2'])) {
            $select->where(['property2' => $params['property2']]);
        }

        if (isset($params['limit'])) {
            $select->limit($params['limit']);
        }

        if (!isset($params['page'])) {
            $params['page'] = 0;
        }

        $result = (isset($params['limit']) && $params['limit'] == 1)
            ? $this->fetchRow($select)
            : $this->fetchAll($select, ['limit' => $this->resultsPerPage, 'page' => $params['page']]);

        return $result;
    }

    public function patch(int $id, array $data)
    {
        if (empty($data)) {
            throw new \Exception('missing data to update');
        }
        $passedData = [];

        if (!empty($data['property1'])) {
            $passedData['property1'] = $data['property1'];
        }

        if (!empty($data['property2'])) {
            $passedData['property2'] = $data['property2'];
        }

        $this->tableGateway->update($passedData, ['id' => $id]);
    }

    public function getById(\Rowset\ModelName $rowset)
    {
        return parent::saveRow($rowset);
    }

    public function delete($id)
    {
        if (empty($id)) {
            throw new \Exception('missing comics id to delete');
        }
        parent::deleteRow($id);
    }

}
```

### Form

[](#form)

Generate sample model with a list of properties:

```
"vendor/bin/laminas.bat" mvc:form --properties= --properties= --module=
```

New file in: `[root]/module/[moduleName]/src/Form/[name]Form.php`

Sample output:

```
namespace ModuleName\Form;

use \Laminas\Form\Element;

class NewUserForm extends \Laminas\Form\Form implements \Laminas\InputFilter\InputFilterProviderInterface
{

     const ELEMENT_PROPERTY1 = 'property1';

     const ELEMENT_PROPERTY2 = 'property2';

    public function __construct($name, array $params)
    {
        parent::__construct($name, $params);
        $this->setAttribute('class', 'styledForm');

        $this->add([
            'name' => self::ELEMENT_PROPERTY1,
            'type' => 'text',
            'options' => [
                'label' => 'property1'
            ],
            'attributes' => [
                'required' => true
            ]
        ]);

        $this->add([
            'name' => self::ELEMENT_PROPERTY2,
            'type' => 'text',
            'options' => [
                'label' => 'property2'
            ],
            'attributes' => [
                'required' => true
            ]
        ]);

        $this->add([
            'name' => 'submit',
            'type' => 'submit',
            'attributes' => [
                'value' => 'Submit',
                'class' => 'btn btn-primary'
            ]
        ]);
    }

    public function getInputFilterSpecification()
    {
        return [];
    }

}
```

### Rowset

[](#rowset)

Generate sample rowset with a list of params:

```
"vendor/bin/laminas.bat" mvc:rowset --properties= --properties= --module=ModuleName
```

New file in: `[root]/module/[moduleName]/src/Model/Rowset/[name].php`

Sample output:

```
namespace ModuleName\Model;

class RowsetName
{

    public $property1 = null;

    public $property2 = null;

    public function getProperty1()
    {
        return $this->property1;
    }

    public function setProperty1($value)
    {
        $this->property1 = $value;
        return $this;
    }

    public function getProperty2()
    {
        return $this->property2;
    }

    public function setProperty2($value)
    {
        $this->property2 = $value;
        return $this;
    }

}
```

### View

[](#view)

Generate sample .phtml view file:

```
"vendor/bin/laminas-cli.bat" mvc:view --module=ModuleName
```

New file in: `[root]/module/[moduleName]/view/[controllerName]/[name].phtml`

Sample output:

```
ModuleName - ViewName
```

CRUD
----

[](#crud)

Generate a full working example with Form, Rowset, Model, View and Controller with given name:

```
"vendor/bin/laminas.bat" mvc:crud --properties= --properties= --module=ModuleName
```

New files in:

```
[root]/module/[moduleName]/src/Controller/[name]Controller.php
[root]/module/[moduleName]/src/Model/[name]Model.php
[root]/module/[moduleName]/src/Model/AbstractTable.php
[root]/module/[moduleName]/src/Form/[name]Form.php
[root]/module/[moduleName]/src/Model/Rowset/[name].php
[root]/module/[moduleName]/src/Model/Rowset/AbstractModel.php
[root]/module/[moduleName]/view/[name]/index.phtml
[root]/module/[moduleName]/view/[name]/pagination.phtml
[root]/module/[moduleName]/view/[name]/add.phtml
[root]/module/[moduleName]/view/[name]/delete.phtml
[root]/module/[moduleName]/view/[name]/edit.phtml
[root]/module/[moduleName]/config/generated.crud.php

```

Configuration in: `config/generated.crud.php`

Sample output for module: `ModuleName` and name: `NewUsers`:

```
namespace ModuleName;

use Laminas\Router\Http\Segment;
use Laminas\Db\ResultSet\ResultSet;
use Laminas\Db\TableGateway\TableGateway;
use ModuleName\Model\Rowset;
use ModuleName\Model;
use ModuleName\Controller;

return [
    'router' => [
        'routes' => [
            'newUsers' => [
                'type' => Segment::class,
                'options' => [
                    'route' => '/newusers[/:action[/:id]]',
                    'defaults' => [
                        'controller' => Controller\NewUsersController::class,
                        'action' => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes' => [
                    'paginator' => [
                        'type' => 'segment',
                        'options' => [
                            'route' => '/[page/:page]',
                            'defaults' => [
                                'page' => 1
                            ]
                        ]
                    ],
                ]
            ]
        ]
    ],

    'controllers' => [
        'factories' => [
            Controller\NewUsersController::class => function($sm) {
                $postService = $sm->get(Model\NewUsersTable::class);

                return new Controller\NewUsersController($postService);
            },
        ]
    ],

    'service_manager' => [
        'factories' => [
            'NewUsersTableGateway' => function ($sm) {
                $dbAdapter = $sm->get('Laminas\Db\Adapter\Adapter');
                $config = $sm->get('Config');
                $baseUrl = $config['view_manager']['base_url'];
                $resultSetPrototype = new ResultSet();
                $identity = new Rowset\NewUser($baseUrl);
                $resultSetPrototype->setArrayObjectPrototype($identity);
                return new TableGateway('newusers', $dbAdapter, null, $resultSetPrototype);
            },
            Model\NewUsersTable::class => function($sm) {
                $tableGateway = $sm->get('NewUsersTableGateway');
                $table = new Model\NewUsersTable($tableGateway);
                return $table;
            },
        ]
    ],

    'view_manager' => [
        'template_map' => [
            'module-name/new-users/index' => __DIR__ . '/../view/NewUsers/index.phtml',
            'module-name/new-users/edit' => __DIR__ . '/../view/NewUsers/edit.phtml',
            'module-name/new-users/add' => __DIR__ . '/../view/NewUsers/add.phtml',
            'module-name/new-users/pagination' => __DIR__ . '/../view/NewUsers/pagination.phtml',
        ],
    ]
];
```

Users Login &amp; Registration
------------------------------

[](#users-login--registration)

Generate Users registration and login feature with custom user properties

```
"vendor/bin/laminas.bat" mvc:login-registration --properties= --properties= --module=ModuleName
```

New files in:

```
[root]/module/[moduleName]/src/Controller/LoginController.php
[root]/module/[moduleName]/src/Controller/RegisterController.php
[root]/module/[moduleName]/src/Model/UserModel.php

```

Configuration in: `config/module.config.php``src/Module.php`

Admin Panel
-----------

[](#admin-panel)

Add an admin panel to your Laminas MVC project and provide Reports and Users managment tool.

```
"vendor/bin/laminas.bat" mvc:admin --module=ModuleName
```

New files in:

```
[root]/module/[moduleName]/src/Controller/AbstractController.php
[root]/module/[moduleName]/src/Controller/AdminController.php
[root]/module/[moduleName]/src/view/admin/admin/index.phtml
[root]/module/[moduleName]/src/view/admin/_shared/footer.phtml
[root]/module/[moduleName]/src/view/admin/_shared/menu.phtml
[root]/module/[moduleName]/src/view/layout/admin.phtml
[root]/module/[moduleName]/src/Model.php

```

Configuration in: `config/module.config.php``src/Module.php`

Navigation
----------

[](#navigation)

Add a default menu navigation specified with given items.

```
"vendor/bin/laminas.bat" mvc:navigation --items= --items= --module=ModuleName
```

New files in:

```
[root]/module/[moduleName]/src/Controller/AbstractController.php
[root]/module/[moduleName]/src/Controller/AdminController.php
[root]/module/[moduleName]/src/view/[moduleName]/layout/layout.phtml
[root]/module/[moduleName]/src/view/_shared/menu.phtml

```

Configuration in: `config/autoload/global.php`

Sitemap
-------

[](#sitemap)

Add a sitemap controller serving file in XML Google foramt.

```
"vendor/bin/laminas.bat" mvc:sitemap --module=ModuleName
```

New files in:

```
[root]/module/[moduleName]/src/Controller/SitemapController.php
[root]/module/[moduleName]/src/view/[moduleName]/sitemap/index.phtml

```

Configuration in: `[root]/module/[moduleName]/config/module.config.php`

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 98.8% 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 ~94 days

Recently: every ~131 days

Total

11

Last Release

1266d ago

Major Versions

0.4 → 1.12020-08-10

PHP version history (2 changes)0.2PHP ^7.1

1.4PHP ^7.1 || ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0c29bdb88fb890bf070da93175114f6fadf233a0fa4e0d8042f573855c12bf5?d=identicon)[divix1988](/maintainers/divix1988)

---

Top Contributors

[![divix1988](https://avatars.githubusercontent.com/u/6444400?v=4)](https://github.com/divix1988 "divix1988 (83 commits)")[![adam-omelak](https://avatars.githubusercontent.com/u/84100399?v=4)](https://github.com/adam-omelak "adam-omelak (1 commits)")

---

Tags

cliconsolelaminascommand

### Embed Badge

![Health badge](/badges/divix1988-laminas-cli-commands/health.svg)

```
[![Health](https://phpackages.com/badges/divix1988-laminas-cli-commands/health.svg)](https://phpackages.com/packages/divix1988-laminas-cli-commands)
```

###  Alternatives

[helhum/typo3-console

A reliable and powerful command line interface for TYPO3 CMS

2939.0M192](/packages/helhum-typo3-console)[laminas/laminas-cli

Command-line interface for Laminas projects

563.7M54](/packages/laminas-laminas-cli)[adhocore/cli

Command line interface library for PHP

3501.2M50](/packages/adhocore-cli)[aplus/cli

Aplus Framework CLI Library

2301.7M6](/packages/aplus-cli)[inhere/console

php console library, provide console argument parse, console controller/command run, color style, user interactive, information show.

3477.4k12](/packages/inhere-console)[hydreflab/laravel-make-me

Extendable Interactive Make Command for Laravel

371.2k](/packages/hydreflab-laravel-make-me)

PHPackages © 2026

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