2017 © Pedro Peláez
 

library zf-symfony-console

symfony/console module for zendframework3+

image

eth8505/zf-symfony-console

symfony/console module for zendframework3+

  • Tuesday, February 13, 2018
  • by eth8505
  • Repository
  • 1 Watchers
  • 0 Stars
  • 49 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

!!!! THIS PACKAGE IS NO LONGER MAINTAINED, PLEASE USE eth8505/laminas-symfony-console INSTEAD !!!!, (*1)

Eth8585\ZfSymfonyConsole - Zend Framework 3 Symfony Console Module

The Eth8585\ZfSymfonyConsole module allows to use the symfony console component with Zend Framework 3., (*2)

How to install

Install eth8505/zf-symfony-console package via composer., (*3)

$ composer require eth8505/zf-symfony-console

Load the module in your application.config.php file like so:, (*4)

<?php

return [
    'modules' => [
        'Eth8505\ZfSymfonyConsole\\',
        // ...
    ],
];

How to use

You can use the vendor/bin/console tool to run your commands. This tool may be in a different directory depending on how your composers bin-dir is configured., (*5)

Depending on how you did setup your Zend Framework 3 project, you might need to modify public/index.php. For example this is neccassary if you did use the Zend MVC Skeleton project., (*6)

Firstly that file has to return the Application instance for this library to work., (*7)

Optionally you might only invoke the run() method of Zend\Mvc\Application if public/index.php has not been called via the PHP CLI. This will avoid cluttering up your console with the view., (*8)

How do I create console commands?

1. Create command

Create commands as described in the symfony console docs. Please note that if you're using a fully-fledged zend-framework, it won't be possible to use all the nice symfony service container logic., (*9)

2. Register with service manager

You can either register your commands with the service manager via the config in your module.config.php:, (*10)

<?php

return [
    'zfsymfonyconsole_commands' => [
        'invokables' => [
            MyCommand::class
        ]
    ]
];

or register it in your module class using the ConsoleCommandProviderInterface:, (*11)

<?php

namespace MyModule;

use Eth8505\ZfSymfonyConsole\ConsoleCommandProviderInterface;

class Module implements ConsoleCommandProviderInterface {

    /**
     * @inheritdoc 
     */
    public function getConsoleCommandConfig() {

        return [
            'invokables' => [
                MyCommand::class
            ]
        ];

    }

}

3. Your command is ready to go

Your command will now show up when using the bin/console utility and can be called with whatever you set up in the commands configure method., (*12)

Thanks

Thanks to Rafi Adnan and his RDN Console module which this module is loosely based upon., (*13)

The Versions

13/02 2018

dev-master

9999999-dev

symfony/console module for zendframework3+

  Sources   Download

MIT

The Requires

 

by Avatar eth8505

console zend sf3 symfony zf3

13/02 2018

1.1.0

1.1.0.0

symfony/console module for zendframework3+

  Sources   Download

MIT

The Requires

 

by Avatar eth8505

console zend sf3 symfony zf3

23/11 2017

1.0.0

1.0.0.0

symfony/console module for zendframework3+

  Sources   Download

MIT

The Requires

 

by Avatar eth8505

console zend sf3 symfony zf3