class RunserverCommands extends DrushCommands (View source)

Traits

ProcessManagerAwareTrait
LoggerAwareTrait
IO
ConfigAwareTrait

Constants

REQ

OPT

EXIT_SUCCESS

EXIT_FAILURE

Properties

protected $uri

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.

bool
startBrowser($uri = null, int $sleep = 0, bool $port = false, bool $browser = true)

Starts a background browser/tab for the current site or a specified URL.

from ExecTrait
static 
programExists($program)

No description

from ExecTrait
static 
getEditor()

No description

from ExecTrait
runserver($uri = null, $options = ['default-server' => self::REQ, 'browser' => true, 'dns' => false])

Runs PHP's built-in http server for development.

uri($uri, $options)

Determine the URI to use for this server.

array
parseUri(string $uri)

Parse a URI or partial URI (including just a port, host IP or path).

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.

bool startBrowser($uri = null, int $sleep = 0, bool $port = false, bool $browser = true)

Starts a background browser/tab for the current site or a specified URL.

Uses a non-blocking Process call, so Drush execution will continue.

Parameters

$uri Optional URI or site path to open in browser. If omitted, or if a site path is specified, the current site home page uri will be prepended if the site's hostname resolves.
int $sleep
bool $port
bool $browser

Return Value

bool TRUE if browser was opened. FALSE if browser was disabled by the user or a default browser could not be found.

static programExists($program)

Parameters

$program

static getEditor()

runserver($uri = null, $options = ['default-server' => self::REQ, 'browser' => true, 'dns' => false])

Runs PHP's built-in http server for development.

  • Don't use this for production, it is neither scalable nor secure for this use.
  • If you run multiple servers simultaneously, you will need to assign each a unique port.
  • Use Ctrl-C or equivalent to stop the server when complete.

Parameters

$uri
$options

uri($uri, $options)

Determine the URI to use for this server.

Parameters

$uri
$options

array parseUri(string $uri)

Parse a URI or partial URI (including just a port, host IP or path).

Parameters

string $uri String that can contain partial URI.

Return Value

array URI array as returned by parse_url.