class PhpCommands extends DrushCommands implements StdinAwareInterface (View source)

Traits

StdinAwareTrait
ProcessManagerAwareTrait
LoggerAwareTrait
IO
ConfigAwareTrait

Constants

REQ

OPT

EXIT_SUCCESS

EXIT_FAILURE

Methods

getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

__construct()

No description

LoggerInterface
logger()

Returns a logger object.

io()

Override Robo's IO function with our custom style.

printFile(string $file)

Print the contents of a file.

evaluate($code, $options = ['format' => 'var_export'])

Evaluate arbitrary php code after bootstrapping Drupal (if available).

script(array $extra, $options = ['format' => 'var_export', 'script-path' => self::REQ])

Run php a script after a full Drupal bootstrap.

Details

DrushConfig getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

__construct()

protected LoggerInterface logger()

Returns a logger object.

Return Value

LoggerInterface

protected io()

Override Robo's IO function with our custom style.

protected printFile(string $file)

Print the contents of a file.

Parameters

string $file Full path to a file.

evaluate($code, $options = ['format' => 'var_export'])

Evaluate arbitrary php code after bootstrapping Drupal (if available).

Parameters

$code
$options

script(array $extra, $options = ['format' => 'var_export', 'script-path' => self::REQ])

Run php a script after a full Drupal bootstrap.

A useful alternative to eval command when your php is lengthy or you can't be bothered to figure out bash quoting. If you plan to share a script with others, consider making a full Drush command instead, since that's more self-documenting. Drush provides commandline options to the script via a variable called $extra.

Parameters

array $extra
$options

Exceptions

Exception