99designs/repl-bundle

This package is abandoned and no longer maintained. The author suggests using the theofidry/psysh-bundle package instead.
There is no license information available for the latest version (2.0.2) of this package.

Add a Boris repl command to the Symfony console

2.0.2 2021-06-29 04:18 UTC

This package is not auto-updated.

Last update: 2021-06-29 04:28:14 UTC


README

Important: This bundle is no longer under active development. Consider using PsyshBundle as an alternative.

Provides a repl command for the Symfony console, powered by Boris.

Installation

Add as a development dependency to composer.json:

composer require --dev 99designs/repl-bundle

Register the bundle in app/AppKernel.php:

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // all your run-time bundles
        );

        if ($this->getEnvironment() == 'dev') {
            $bundles[] = new NinetyNine\Bundle\ReplBundle();
        }

        return $bundles;
    }
}

Usage

Run via the Symfony console:

app/console repl

The following variables are imported into the global namespace:

  • $kernel: Application kernel
  • $container: The DI container

Issues

Boris depends on PHP's process control extension. Even if this is installed, you may see errors like this:

PHP Warning:  pcntl_fork() has been disabled for security reasons in /my-project/vendor/d11wtq/boris/lib/Boris/Boris.php on line 148
PHP Notice:  fwrite(): send of 1 bytes failed with errno=32 Broken pipe in /my-project/vendor/d11wtq/boris/lib/Boris/EvalWorker.php on line 205

If you see these errors, you'll need to edit your PHP CLI configuration (typically found at /etc/php5/cli/php.ini) to allow invocation of the named functions.