passbolt/passbolt_api · info

$ php composer.phar require psy/psysh</info>

Error message

<info>$ php composer.phar require psy/psysh</info>

What it means

This is the suggested remediation command line printed by ConsoleCommand::execute() as part of the Psy\Shell-not-found guidance: '<info>$ php composer.phar require psy/psysh</info>'. It is informational CLI output (wrapped in CakePHP <info> tags) showing the exact composer command the developer should run, not an error thrown by the library.

Solutions

  1. Execute the suggested command: php composer.phar require psy/psysh (or composer require psy/psysh if composer is installed globally).
  2. If psysh should be a dev-only tool, add it with --dev so production installs without --no-dev still lack it and this hint remains correct.
  3. Re-run bin/cake console after installation to confirm the shell starts.

Example fix

// before
$ bin/cake console
If you are using composer run
$ php composer.phar require psy/psysh

// after
$ php composer.phar require psy/psysh
$ bin/cake console
You can exit with `CTRL-C` or `exit`
Defensive patterns

Strategy: validation

Validate before calling

if php -r "exit(class_exists('Psy\\Shell') ? 0 : 1);"; then bin/cake console; else php composer.phar require psy/psysh; fi

Prevention

When it happens

Trigger: Emitted whenever the console command runs and class_exists('Psy\Shell') is false — i.e. psy/psysh is missing from the autoloader.

Common situations: Developers see this hint in the terminal after bin/cake console fails on a fresh clone, in CI containers without dev dependencies, or on hosts where only composer.phar (not a global composer) is available.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/222efa82f041303d. Report an issue: GitHub.

Appendix: source

Thrown at src/Command/ConsoleCommand.php:49

{
    /**
     * Start the Command and interactive console.
     *
     * @param \Cake\Console\Arguments $args The command arguments.
     * @param \Cake\Console\ConsoleIo $io The console io
     * @return int|null|void The exit code or null for success
     */
    public function execute(Arguments $args, ConsoleIo $io) // phpcs:ignore
    {
        if (!class_exists('Psy\Shell')) {
            $io->err('<error>Unable to load Psy\Shell.</error>');
            $io->err('');
            $io->err('Make sure you have installed psysh as a dependency,');
            $io->err('and that Psy\Shell is registered in your autoloader.');
            $io->err('');
            $io->err('If you are using composer run');
            $io->err('');
            $io->err('<info>$ php composer.phar require psy/psysh</info>');
            $io->err('');

            return static::CODE_ERROR;
        }

        $io->out('You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>');
        $io->out();

        Log::drop('debug');
        Log::drop('error');
        $io->setLoggers(false);
        restore_error_handler();
        restore_exception_handler();

        $psy = new PsyShell(new PsyConfiguration([
            'updateCheck' => 'never',
        ]));
        $psy->run();

View on GitHub (pinned to 31c1bbc10f)