Console component from Zend Framework

Overview

zend-console

Repository abandoned 2019-12-31

This repository has moved to laminas/laminas-console.

Build Status Coverage Status

Zend\Console is a component to design and implement console applications in PHP.

Deprecated

Both the zend-console and the zend-mvc-console components will likely not be maintained long-term, as there are more complete implementations available elsewhere. We strongly urge developers to start migrating their console tooling to use other libraries, such as symfony/console.

Comments
  • zend-console not working as documented

    zend-console not working as documented

    The Docs say:

    When a zend-mvc application is run from a console window (a shell window or Windows command prompt), it will recognize this fact and prepare zend-mvc components to handle the request. Console support is enabled by default, but to function properly it requires at least one console route and one action controller to handle the request. [...]

    That seems not to be true and i can't find any code in zend-mvc (v3) that handles console-requests.

    This doc should be replaced by working examples.

    May be, this is an version issue. So zend-console should require zend-mvc v2 or documentation should point out that this only works with zend-mvc v2. ... and generally provide only documentation for its on functionality and usage.

    bug documentation 
    opened by FalkHe 9
  • Add catch-all route parameters.

    Add catch-all route parameters.

    • You can now use [...params] to collect all "left over" parameters to a single array.
    • Useful for implementing routes with arbitrary parameter counts (e.g. reimplementing "echo" or acting on an arbitrary list of files); also useful for situations where complex validation needs to be applied in the controller.
    • This provides a solution to the long-standing unresolved issue at https://github.com/zendframework/zendframework/issues/6195

    I'd love to see this functionality merged to the project, as the ability to deal with arbitrary parameter lists is important to me. However, I am not wedded to this exact approach and would be happy to discuss alternative approaches if others have different preferences.

    enhancement Needs Documentation 
    opened by demiankatz 7
  • ZF3

    ZF3

    Hi @Maks3w and others ^^ Just to know if there is a channel of communication about zend-console and ZF3 Just want to contribute and add or port new features because zend-console is ... really poor :-1: .

    opened by merlindorin 4
  • Missing infos on zend-mvc-console

    Missing infos on zend-mvc-console

    Missing infos:

    • For MVC Routing zend-console needs zend-mvc-console
    • zend-mvc-console is deprecated! See also: https://github.com/zendframework/zend-console/issues/34
    enhancement documentation 
    opened by mdthh 2
  • Check All Headers In Documentation

    Check All Headers In Documentation

    Check headers are correct

    TLDR; Headers should use the #, ## etc to format different levels of headers, and not be underlines using ===== or ``-----`, or be psuedo header using bold

    Check all headers on the documentation - headers should use the hash style of declaration rather then be underlined with equals or dashes. The more hashes, the more of a subheading. Eg:

    • # is equal to <h1>
    • ## is equal to <h2>
    • ### is equal to <h3>
    • #### is equal to <h4>
    • ##### is equal to <h5>

    Headings should be appropriate for their level in the documentation.

    Psuedo headers using bold tags ** should be replaced with appropriate level of heading tag.

    EasyFix documentation 
    opened by GeeH 2
  • Actually use result of array_unique

    Actually use result of array_unique

    This bug may have been harmless, the resulting regex built would have been longer but functionally equivalent.

    Add simple test that parsing options with duplicates continues to succeed. (I didn't see any other tests of duplicates)

    Fixes #43

    Provide a narrative description of what you are trying to accomplish:

    • [x] Are you fixing a bug?
      • [ ] Detail how the bug is invoked currently.
      • [x] Detail the original, incorrect behavior.
      • [x] Detail the new, expected behavior. (behavior seems to be equivalent to end users)
      • [ ] Base your feature on the master branch, and submit against that branch.
      • [ ] Add a regression test that demonstrates the bug, and proves the fix. (can't really do without accessing protected properties, which seems like a poor test)
      • [ ] Add a CHANGELOG.md entry for the fix.
    opened by TysonAndre 1
  • array_unique is misused in RouteMatcher->parseDefinition(), and does nothing

    array_unique is misused in RouteMatcher->parseDefinition(), and does nothing

    • [x] I was not able to find an open or closed issue matching what I'm seeing.
    • [x] This is not a question.

    Provide a narrative description of what you are trying to accomplish.

    Code to reproduce the issue

    php > $r = new Zend\Console\RouteMatcher\DefaultRouteMatcher('[--foo | --foo]');                     
    php > var_export($r);
    Zend\Console\RouteMatcher\DefaultRouteMatcher::__set_state(array(
       'parts' => 
      array (
        0 => 
        array (
          'name' => 'unnamedGroupAt1',
          'literal' => false,
          'required' => false,
          'positional' => false,
          'alternatives' => 
          array (
            0 => 'foo',
            1 => 'foo',
          ),
          'hasValue' => false,
        ),
      ),
    

    Expected results

    'alternatives' should have 'foo' once, at least according to code comments

    Actual results

    'foo' occurs twice.


    See http://php.net/manual/en/function.array-unique.php - this does not modify the input

    Takes an input array and returns a new array without duplicate values.

    This snippet occurs 4 times in src/RouteMatcher/DefaultRouteMatcher.php - It probably should be $options = array_unique($options); instead.

                    // remove dupes
                    array_unique($options);
    

    This was detected by static analysis, and may be harmless. I'm not sure of the impact of fixing this.

    opened by TysonAndre 1
  • Use the console adapter to write instead of echo.

    Use the console adapter to write instead of echo.

    The Char prompt was just echoing directly rather than using the writeLine() method from the Console adapter. This was done correctly in the Select prompt already. Using echo can make testing more difficult because you can't mock the write away and instead of to do hacky things like using output buffering.

    enhancement 
    opened by griffbrad 1
  • Check Documentation Tables

    Check Documentation Tables

    Check the tables in a document

    TLDR; All tables should be in the format of GHFM using | and - as horizontal and vertical separators respectively

    Check all tables are in the correct format. Please don't use leading and trailing | - more information on github flavoured markdown tables can be found here.

    EasyFix documentation 
    opened by GeeH 1
  • spelling fixes

    spelling fixes

    patch contains some spelling fixes ( just in comments ) as found by a bot ( http://www.misfix.org, https://github.com/ka7/misspell_fixer ). Any upcoming License changes (e.g. GPL2 to GPL3+) are hereby granted.

    opened by ka7 0
  • add composer.lock & update travis config

    add composer.lock & update travis config

    as per zendframework/zendframework#7660

    also entails these changes:

    • bump minimum php version to 5.6
    • bump minimum phpunit version to 4.8
    • add composer scripts entries
    • fix coveralls configuration
    • fix travis.yml env variables to not be affected by travis-ci/travis-ci#1444
    • remove obsolete phpunit bootstrap
    opened by stefanotorresi 0
  • Mandatory Value Parameters can not be parsed

    Mandatory Value Parameters can not be parsed

    I tried to create a route where a group of Value Parameters is mandatory like this example:

    <?php
    return [
    // ....
            'console-export-prepared-products' => [
                'options' => [
                    'route' => 'export prepared products (--from-file=|--model=)',
                    'defaults' => [
                        'controller' => \Controller\PreparedProductsController::class,
                        'action' => 'export',
                        'verbose' => false,
                    ]
                ]
            ],
            //...
      ];
    

    But this results into a InvalidArgumentException:

    Fatal error: Uncaught exception 'Zend\Console\Exception\InvalidArgumentException' with message 'Cannot understand Console route at "(--from-file=|--model=)"' in /var/www/mw/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 946 Zend\Console\Exception\InvalidArgumentException: Cannot understand Console route at "(--from-file=|--model=|--recent)" in /var/www/mw/vendor/zendframework/zendframework/library/Zend/Console/RouteMatcher/DefaultRouteMatcher.php on line 432

    I expected that the route is only matched if either the parameter --from-file or --model is set.

    opened by zf2timo 3
  • modules.md syntax & getConsoleUsage() / getConsoleBanner() not displaying

    modules.md syntax & getConsoleUsage() / getConsoleBanner() not displaying

    opened by lrochas 1
  • zend-console should not be required by zend-mvc

    zend-console should not be required by zend-mvc

    This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


    Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7107 User: @marc-mabe Created On: 2015-01-07T18:16:45Z Updated At: 2015-04-03T06:51:53Z Body The zend-console component is already within the suggest part of composer but in fact if you use zend-mvc only for HTTP handling using defaults you have to install zend-console only because it's using Console::isConsole().

    see https://github.com/zendframework/zf2/blob/67f098af070b29d5042e89e936604df3193d2212/library/Zend/Mvc/Service/RequestFactory.php#L28 see https://github.com/zendframework/zf2/blob/67f098af070b29d5042e89e936604df3193d2212/library/Zend/Mvc/Service/ResponseFactory.php#L28

    This simple check should be replaced by PHP_SAPI == 'cli'. I don't know if it's required for testing to virtually mark the current running script as non CLI but this should be simple enough to be duplicated in zend-mvc to not require zend-console.


    Comment

    User: @Ocramius Created On: 2015-01-07T18:23:00Z Updated At: 2015-01-07T18:23:00Z Body The MVC is supposed to run both in console and in HTTP environments: I don't think that should be changed at all (personal opinion).

    Also, please remember to use absolute commit-based URIs when linking code, or the references will be lost as the branches get updated.


    Comment

    User: @marc-mabe Created On: 2015-01-07T18:29:44Z Updated At: 2015-01-07T18:30:03Z Body

    The MVC is supposed to run both in console and in HTTP environments Than it would need to be part of the required section.

    In my opinion the mvc should not hard require HTTP or Console. Sure it's designed to work with both and that's very nice but it should not be required.


    Comment

    User: @marc-mabe Created On: 2015-01-07T18:32:57Z Updated At: 2015-01-07T18:32:57Z Body

    Also, please remember to use absolute commit-based URIs when linking code, or the references will be lost as the branches get updated.

    updated links to reference the latest commit


    Comment

    User: @Pittiplatsch Created On: 2015-01-08T06:42:33Z Updated At: 2015-01-08T06:42:33Z Body

    In my opinion the mvc should not hard require HTTP or Console. Sure it's designed to work with both and that's very nice but it should not be required.

    +1 Maybe kind of IOC can help here, i.e. let zend-console inject some flag into zend-mvc during bootstrap? Should be trivial by using an appropriate event...


    Comment

    User: @harikt Created On: 2015-04-03T06:51:52Z Updated At: 2015-04-03T06:51:52Z Body Hi @Ocramius ,

    I was learning zend-mv from the docs http://framework.zend.com/manual/current/en/modules/zend.mvc.intro.html

    I have came across a few dependency that the zend-mvc really need or throw errors not found.

            "zendframework/zend-modulemanager": "~2.4",
            "zendframework/zend-loader": "~2.4",
            "zendframework/zend-view": "~2.4",
            "zendframework/zend-serializer": "~2.4",
            "zendframework/zend-log": "~2.4",
            "zendframework/zend-i18n":"~2.4",
            "zendframework/zend-console": "~2.4",
            "zendframework/zend-http": "~2.4",
            "zendframework/zend-cache": "~2.4"
    

    Though, some of you may disagree with me.

    Thanks


    opened by GeeH 1
  • Bug in Zend\Console\Prompt\Select::show()

    Bug in Zend\Console\Prompt\Select::show()

    This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


    Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7465 User: @IvanoP Created On: 2015-04-28T11:15:45Z Updated At: 2015-11-06T21:28:47Z Body This method can't support more of 9 items


    Comment

    User: @DASPRiD Created On: 2015-04-28T11:19:43Z Updated At: 2015-04-28T11:19:43Z Body Can you be more specific?


    Comment

    User: @IvanoP Created On: 2015-04-28T11:43:30Z Updated At: 2015-04-28T11:43:30Z Body In Zend\Console\Prompt\Select the method show() over overrides the show() method in Zend\Console\Prompt\Char. In this method the user input is read by readChar() method. This Method read a single characther. So you cannot input a two char index for a option in Select.


    opened by GeeH 1
  • Password prompt broken on Windows console

    Password prompt broken on Windows console

    This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


    Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7559 User: @waltertamboer Created On: 2015-05-30T08:54:41Z Updated At: 2015-11-06T21:57:00Z Body The password prompt seems to be broken on my Windows 8.1 machine (Zend Framework 2.4.2).

    • It only reads uppercase characters.
    • It shows the characters that are entered.
    • When enter is pressed, the star characters suddenly popup.

    This only happens in the default Windows console, not in the MINGW32 console (git bash).


    opened by GeeH 1
Releases(release-2.8.0)
  • release-2.8.0(Feb 4, 2019)

    Added

    • #41 adds support for PHP 7.3.

    Changed

    • Nothing.

    Deprecated

    • Nothing.

    Removed

    • #41 removes support for zend-stdlib v2 releases.

    Fixed

    • #44 fixes usage of array_unique() within the DefaultRouteMatcher to properly re-assign the array when invoked.
    Source code(tar.gz)
    Source code(zip)
  • release-2.7.0(Jan 25, 2018)

    Added

    • #32 adds a new route match type, the "catch-all". Such types are always optional (thus, appear in [] sets), and are specified using ... within: command [...options].

      Parameters matched this way will always be returned as an array of values.

    • #39 adds support for PHP 7.2.

    Changed

    • Nothing.

    Deprecated

    • Nothing.

    Removed

    • #39 removes support for PHP 5.5.

    • #39 removes support for HHVM.

    Fixed

    • #19 updated link to the documentation in the README
    Source code(tar.gz)
    Source code(zip)
  • release-2.6.0(Feb 9, 2016)

    Added

    • #16 updates, reorganizes, and publishes the documentation to https://zendframework.github.io/zend-console

    Deprecated

    • Nothing.

    Removed

    • Nothing.

    Fixed

    • #13 updates the component to make it forwards-compatible with the zend-stdlib and zend-servicemanager v3 versions.
    • #4 fixes an error in getTitle() whereby the $output array was being incorrectly used as a string.
    • #12 updates the Zend\Console\Prompt\Char::show() method to call on the composed adapter's write()/writeLine() methods instead of calling echo().
    Source code(tar.gz)
    Source code(zip)
Owner
Zend Framework
Zend Framework
ReactPHP Shell, based on the Symfony Console component.

Pecan Event-driven, non-blocking shell for ReactPHP. Pecan (/pɪˈkɑːn/) provides a non-blocking alternative to the shell provided in the Symfony Consol

Michael Crumm 43 Sep 4, 2022
The Hoa\Console library.

Hoa is a modular, extensible and structured set of PHP libraries. Moreover, Hoa aims at being a bridge between industrial and research worlds. Hoa\Con

Hoa 366 Dec 14, 2022
Display your Laravel routes in the console, but make it pretty. 😎

Pretty Routes for Laravel Display your Laravel routes in the console, but make it pretty. ?? Installation You can install the package via composer: co

Alex 630 Dec 30, 2022
Customized loading ⌛ spinner for Laravel Artisan Console.

Laravel Console Spinner Laravel Console Spinner was created by Rahul Dey. It is just a custom Progress Bar inspired by icanhazstring/symfony-console-s

Rahul Dey 71 Oct 26, 2022
It's like Tailwind CSS, but for the console.

Tailcli allows building unique, beautiful command-line applications, using tailwind classes. It's like Tailwind CSS, but for the console. Installation

Nuno Maduro 1.8k Jan 7, 2023
Supercharge your Symfony console commands!

zenstruck/console-extra A modular set of features to reduce configuration boilerplate for your commands: /** * Creates a user in the database. * *

Kevin Bond 29 Nov 19, 2022
🤖 GitHub Action to run symfony console commands.

Symfony Console GitHub Action Usage You can use it as a Github Action like this: # .github/workflows/lint.yml name: "Lint" on: pull_request: push

Nucleos 3 Oct 20, 2022
Laravel Console Toolkit

This Package provides some usefully console features like the attribute syntax for arguments and options, validation, auto ask and casting.

Tobi 29 Nov 29, 2022
Simple and customizable console log output for CLI apps.

Console Pretty Print Simple and customizable console log output for CLI apps. Highlights Simple installation (Instalação simples) Very easy to customi

William Alvares 3 Aug 1, 2022
A powerful command line application framework for PHP. It's an extensible, flexible component, You can build your command-based application in seconds!

CLIFramework CLIFramework is a command-line application framework, for building flexiable, simple command-line applications. Commands and Subcommands

Yo-An Lin 428 Dec 13, 2022
Cilex a lightweight framework for creating PHP CLI scripts inspired by Silex

Cilex, a simple Command Line Interface framework Cilex is a simple command line application framework to develop simple tools based on Symfony2 compon

null 624 Dec 6, 2022
Vendor publish command for Lumen framework.

vendor:publish for Lumen framework This package contains a single command borrowed from the Laravel framework that enables you to use php artisan vend

Laravelista 208 Aug 12, 2022
An Interactive Shell to Lumen Framework.

ABANDONED Please consider to use the official Laravel Tinker, it is also compatible with Lumen: laravel/tinker Lumen Artisan Tinker An Interactive She

Vagner Luz do Carmo 112 Aug 17, 2022
☄️ PHP CLI mode development framework, supports Swoole, WorkerMan, FPM, CLI-Server

☄️ PHP CLI mode development framework, supports Swoole, WorkerMan, FPM, CLI-Server / PHP 命令行模式开发框架,支持 Swoole、WorkerMan、FPM、CLI-Server

Mix PHP 1.8k Jan 3, 2023
Console component from Zend Framework

zend-console Repository abandoned 2019-12-31 This repository has moved to laminas/laminas-console. Zend\Console is a component to design and implement

Zend Framework 47 Mar 16, 2021
Enter-to-the-Matrix-with-Symfony-Console - Reproduction of the "Matrix characterfall" effect with the Symfony Console component.

Enter to the Matrix (with Symfony Console) Reproduction of the "Matrix characterfall" effect with the Symfony Console component. Run Clone the project

Yoan Bernabeu 23 Aug 28, 2022
Console - The Console component eases the creation of beautiful and testable command line interfaces.

Console Component The Console component eases the creation of beautiful and testable command line interfaces. Sponsor The Console component for Symfon

Symfony 9.4k Jan 7, 2023
Laminas\Console is a component to design and implement console applications in PHP.

laminas-console This package is abandoned and will receive no further development! We recommend using laminas/laminas-cli. Laminas\Console is a compon

Laminas Project 10 Nov 27, 2021
Authentication component from Zend Framework

zend-authentication Repository abandoned 2019-12-31 This repository has moved to laminas/laminas-authentication. The Zend\Authentication component pro

Zend Framework 43 Jun 13, 2021