mlo/console-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Symfony Bundle for interacting with the Symfony container through the command line

Installs: 22 563

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

v2.0.0 2020-08-23 17:31 UTC

This package is auto-updated.

Last update: 2023-01-23 23:04:40 UTC


README

Interact with Symfony's container through the command line. Uses Psysh for the console.

Installation

composer require --dev mlo/console-bundle

If you aren't using Symfony Flex, you will need to register the bundle in AppKernel.php in the dev and/or test environment.

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    $bundles[] = new Mlo\ConsoleBundle\MloConsoleBundle();
}

If you are using Symfony 4 or lower, require the v1 version of this package.

composer require --dev mlo/console-bundle:^1.0

Usage

bin/console tinker

This will drop you in a Psysh shell with the variables $container, $kernel and $this, which references the container.

Adding Variables

You can add custom variables to the shell scope with the following config:

mlo_console:
    variables:
        debug: "%kernel.debug%"
        em: "@doctrine.orm.entity_manager"

Now you will have a $debug variable with the value of the kernel.debug parameter and $em with your entity manager.