x-team/wp-cli-ssh — pull request #11 by gMagicScott (2014-01-13 20:42:21+00:00)
Title: Play nice with other packages that autoload

Since in the `composer.json` the autoload is set to files, it gets loaded in memory for [every time Composer sets up autoload](http://getcomposer.org/doc/04-schema.md#files).

When other installed packages require Composer's autoloader, this file get's included. The core of WP-CLI doesn't autoload anything unless the binary is called. The classes `WP_CLI_Command` and `WP_CLI` aren't available and leads to a fatal error

```
PHP Fatal error: Class 'WP_CLI_Command' not found in [ABSPATH]/vendor/x-team/wp-cli-ssh/wp-cli-ssh.php on line 31
```

When inside a WP-CLI command, during the bootstrap, it defines 'WP_CLI_ROOT' [here](https://github.com/wp-cli/wp-cli/blob/master/php/boot-phar.php) or [here](https://github.com/wp-cli/wp-cli/blob/master/php/boot-fs.php). By testing for that constant and returning early, the fatal error can be prevented.