Menu

## StartServer extends BaseCommand
in package
Uses InteractsWithTime

StartServer.php : 14

For starting the command line server. This should be good choice only in development

##### Tags

author

  Jet - ezrajet9@gmail.com

### Table of Contents

#### Properties

$aliases : array<string|int, mixed>
  The default aliases of the command.
$description : string
  The name of the command.
$help : string
  The help message of the command.
$hidden : bool
  The default hidden status of the command.
$input : InputInterface
  The input interface implementation.
$macros : array<string|int, mixed>
$name : string
  The name of the command.
$output : OutputStyle
  The output interface implementation.
$portOffset : int
  The current port offset.
$reattempts : int
  Number of times to re-attempt a lost connection
$signature : string
  The default signature of the command.
$verbosity : int
  The default verbosity of output commands.
$verbosityMap : array<string|int, mixed>
  The mapping between human readable verbosity levels and Symfony's OutputInterface.
$app : PioniaApplication|null

#### Methods

__call() : mixed
  Dynamically handle calls to the class.
__callStatic() : mixed
  Dynamically handle calls to the class.
__construct() : mixed
alert() : void
  Write a string in an alert box.
anticipate() : mixed
  Prompt the user for input with auto completion.
argument() : array<string|int, mixed>|string|bool|null
  Get the value of a command argument.
arguments() : array<string|int, mixed>
  Get all of the arguments passed to the command.
ask() : mixed
  Prompt the user for input.
askWithCompletion() : mixed
  Prompt the user for input with auto completion.
call() : int
  Call another console command.
callCommand() : int
callSilent() : int
  Call another console command without output.
callSilently() : int
  Call another console command without output.
choice() : string|array<string|int, mixed>
  Give the user a single choice from an array of answers.
comment() : void
  Write a string as comment output.
confirm() : bool
  Confirm a question with the user.
error() : void
  Write a string as error output.
flushMacros() : void
  Remove all the macros we had registered
getApp() : PioniaApplication|null
getOutput() : OutputStyle
  Get the output implementation.
hasArgument() : bool
  Determine if the given argument is present.
hasMacro() : bool
  Check if we have a method in the balonables
hasOption() : bool
  Determine if the given option is present.
info() : void
  Write a string as information output.
line() : void
  Write a string as standard output.
macro() : void
  Add a new mixable to the macros
mixin() : void
  Mix another object into the class.
newLine() : $this
  Write a blank line.
option() : string|array<string|int, mixed>|bool|null
  Get the value of a command option.
options() : array<string|int, mixed>
  Get all of the options passed to the command.
question() : void
  Write a string as question output.
resolveCommandNameFromClassName() : string
  Automatically set the command name from the class name.
secret() : mixed
  Prompt the user for input but hide the answer from the console.
setInput() : void
  Set the input interface implementation.
setOutput() : void
  Set the output interface implementation.
table() : void
  Format input to textual table.
warn() : void
  Write a string as warning output.
withProgressBar() : int|iterable<string|int, mixed>|void
  Execute a given callback while advancing a progress bar.
availableAt() : int
  Get the "available at" UNIX timestamp.
context() : array<string|int, mixed>
  Get all of the context passed to the command.
createInputFromArguments() : ArrayInput
  Create an input instance from the given arguments.
currentTime() : int
  Get the current system time as a UNIX timestamp.
execute() : int
  Execute the console command.
getArguments() : array<string|int, mixed>
  Get the console command arguments.
getHostAndPort() : array<string|int, mixed>
  Get the host and port from the host option string.
getOptions() : array<string|int, mixed>
  Get the console command options.
handle() : int
host() : string
  Get the host for the command.
parseDateInterval() : DateInterval|DateTimeInterface|int
  If the given value is an interval, convert it to a DateTime instance.
parseVerbosity() : int
  Get the verbosity level in terms of Symfony's OutputInterface level.
resolveCommand() : Command
  Resolve the console command instance for the given command.
runCommand() : int
  Run the given the console command.
runTimeForHumans() : string
  Given a start time, format the total run time for human readability.
secondsUntil() : int
  Get the number of seconds until the given DateTime.
serverCommand() : array<string|int, mixed>
  Get the full server command.
setVerbosity() : void
  Set the verbosity level.
specifyParameters() : void
  Specify the arguments and options on the command.
port() : int
  The port on which to run the server.
setApp() : void

### Properties

#### $aliases

StartServer.php : 18

The default aliases of the command.

`protected array<string|int, mixed> $aliases = ['server', 'start', 'run', 'serve']`

#### $description

StartServer.php : 32

The name of the command.

`protected string $description = 'Serve the application on the PHP development server'`

#### $help

StartServer.php : 39

The help message of the command.

`protected string $help = 'This command starts the Pionia server. It should be preferred for localhost development only'`

#### $hidden

BaseCommand.php : 68

The default hidden status of the command.

`protected bool $hidden = false`

#### $input

InteractsWithIO.php : 23

The input interface implementation.

`protected InputInterface $input`

#### $macros

Microable.php : 14
`protected static array<string|int, mixed> $macros = []`

#### $name

StartServer.php : 25

The name of the command.

`protected string $name = 'serve'`

#### $output

InteractsWithIO.php : 30

The output interface implementation.

`protected OutputStyle $output`

#### $portOffset

StartServer.php : 46

The current port offset.

`protected int $portOffset = 0`

#### $reattempts

StartServer.php : 52

Number of times to re-attempt a lost connection

`protected int $reattempts = 0`

#### $signature

BaseCommand.php : 40

The default signature of the command.

`protected string $signature`

#### $verbosity

InteractsWithIO.php : 37

The default verbosity of output commands.

`protected int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL`

#### $verbosityMap

InteractsWithIO.php : 44

The mapping between human readable verbosity levels and Symfony's OutputInterface.

`protected array<string|int, mixed> $verbosityMap = ['v' => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, 'vv' => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERY_VERBOSE, 'vvv' => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_DEBUG, 'quiet' => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_QUIET, 'normal' => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL]`

#### $app

BaseCommand.php : 70
`private PioniaApplication|null $app`

### Methods

#### __call()

Microable.php : 101

Dynamically handle calls to the class.

`public __call(string $method, array<string|int, mixed> $parameters) : mixed`

##### Parameters

$method : string
$parameters : array<string|int, mixed>

##### Tags

throws
  BadMethodCallException

#### __callStatic()

Microable.php : 75

Dynamically handle calls to the class.

`public static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed`

##### Parameters

$method : string
$parameters : array<string|int, mixed>

##### Tags

throws
  BadMethodCallException

#### __construct()

BaseCommand.php : 124
`public __construct([PioniaApplication|null $app = null ]) : mixed`

##### Parameters

$app : PioniaApplication|null = null

#### alert()

InteractsWithIO.php : 361

Write a string in an alert box.

`public alert(string $string[, int|string|null $verbosity = null ]) : void`

##### Parameters

$string : string
$verbosity : int|string|null = null

#### anticipate()

InteractsWithIO.php : 156

Prompt the user for input with auto completion.

`public anticipate(string $question, callable|array<string|int, mixed> $choices[, string|null $default = null ]) : mixed`

##### Parameters

$question : string
$choices : callable|array<string|int, mixed>
$default : string|null = null

#### argument()

InteractsWithIO.php : 69

Get the value of a command argument.

`public argument([string|null $key = null ]) : array<string|int, mixed>|string|bool|null`

##### Parameters

$key : string|null = null

##### Return values

array<string|int, mixed>|string|bool|null

#### arguments()

InteractsWithIO.php : 83

Get all of the arguments passed to the command.

`public arguments() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### ask()

InteractsWithIO.php : 143

Prompt the user for input.

`public ask(string $question[, string|null $default = null ]) : mixed`

##### Parameters

$question : string
$default : string|null = null

#### askWithCompletion()

InteractsWithIO.php : 169

Prompt the user for input with auto completion.

`public askWithCompletion(string $question, callable|array<string|int, mixed> $choices[, string|null $default = null ]) : mixed`

##### Parameters

$question : string
$choices : callable|array<string|int, mixed>
$default : string|null = null

#### call()

CallsCommands.php : 28

Call another console command.

`public call(string|Command $command[, array<string|int, mixed> $arguments = [] ]) : int`

##### Parameters

$command : string|Command
$arguments : array<string|int, mixed> = []

##### Return values

int

#### callCommand()

BaseCommand.php : 97
`public callCommand(array<string|int, mixed> $arguments[, Closure|null $postRun = null ]) : int`

##### Parameters

$arguments : array<string|int, mixed>
$postRun : Closure|null = null

##### Tags

throws
  Throwable

##### Return values

int

#### callSilent()

CallsCommands.php : 40

Call another console command without output.

`public callSilent(Command|string $command[, array<string|int, mixed> $arguments = [] ]) : int`

##### Parameters

$command : Command|string
$arguments : array<string|int, mixed> = []

##### Return values

int

#### callSilently()

CallsCommands.php : 52

Call another console command without output.

`public callSilently(string|Command $command[, array<string|int, mixed> $arguments = [] ]) : int`

##### Parameters

$command : string|Command
$arguments : array<string|int, mixed> = []

##### Return values

int

#### choice()

InteractsWithIO.php : 206

Give the user a single choice from an array of answers.

`public choice(string $question, array<string|int, mixed> $choices[, int|string|null $default = null ][, mixed|null $attempts = null ][, bool $multiple = false ]) : string|array<string|int, mixed>`

##### Parameters

$question : string
$choices : array<string|int, mixed>
$default : int|string|null = null
$attempts : mixed|null = null
$multiple : bool = false

##### Return values

string|array<string|int, mixed>

#### comment()

InteractsWithIO.php : 307

Write a string as comment output.

`public comment(string $string[, int|string|null $verbosity = null ]) : void`

##### Parameters

$string : string
$verbosity : int|string|null = null

#### confirm()

InteractsWithIO.php : 131

Confirm a question with the user.

`public confirm(string $question[, bool $default = false ]) : bool`

##### Parameters

$question : string
$default : bool = false

##### Return values

bool

#### error()

InteractsWithIO.php : 331

Write a string as error output.

`public error(string $string[, int|string|null $verbosity = null ]) : void`

##### Parameters

$string : string
$verbosity : int|string|null = null

#### flushMacros()

Microable.php : 61

Remove all the macros we had registered

`public static flushMacros() : void`

#### getApp()

BaseCommand.php : 89
`public getApp() : PioniaApplication|null`

##### Return values

PioniaApplication|null

#### getOutput()

InteractsWithIO.php : 440

Get the output implementation.

`public getOutput() : OutputStyle`

##### Return values

OutputStyle

#### hasArgument()

InteractsWithIO.php : 58

Determine if the given argument is present.

`public hasArgument(int|string $name) : bool`

##### Parameters

$name : int|string

##### Return values

bool

#### hasMacro()

Microable.php : 53

Check if we have a method in the balonables

`public static hasMacro(string $name) : bool`

##### Parameters

$name : string

##### Return values

bool

#### hasOption()

InteractsWithIO.php : 94

Determine if the given option is present.

`public hasOption(string $name) : bool`

##### Parameters

$name : string

##### Return values

bool

#### info()

InteractsWithIO.php : 280

Write a string as information output.

`public info(string $string[, int|string|null $verbosity = null ]) : void`

##### Parameters

$string : string
$verbosity : int|string|null = null

#### line()

InteractsWithIO.php : 293

Write a string as standard output.

`public line(string $string[, string|null $style = null ][, int|string|null $verbosity = null ]) : void`

##### Parameters

$string : string
$style : string|null = null
$verbosity : int|string|null = null

#### macro()

Microable.php : 22

Add a new mixable to the macros

`public static macro(string $key, $value) : void`

##### Parameters

$key : string
$value :

#### mixin()

Microable.php : 35

Mix another object into the class.

`public static mixin(object $mixin[, bool $replace = true ]) : void`

##### Parameters

$mixin : object
$replace : bool = true

##### Tags

throws
  ReflectionException

#### newLine()

InteractsWithIO.php : 378

Write a blank line.

`public newLine([int $count = 1 ]) : $this`

##### Parameters

$count : int = 1

##### Return values

$this

#### option()

InteractsWithIO.php : 105

Get the value of a command option.

`public option([string|null $key = null ]) : string|array<string|int, mixed>|bool|null`

##### Parameters

$key : string|null = null

##### Return values

string|array<string|int, mixed>|bool|null

#### options()

InteractsWithIO.php : 119

Get all of the options passed to the command.

`public options() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### question()

InteractsWithIO.php : 319

Write a string as question output.

`public question(string $string[, int|string|null $verbosity = null ]) : void`

##### Parameters

$string : string
$verbosity : int|string|null = null

#### resolveCommandNameFromClassName()

BaseCommand.php : 112

Automatically set the command name from the class name.

`public resolveCommandNameFromClassName() : string`

##### Return values

string

#### secret()

InteractsWithIO.php : 187

Prompt the user for input but hide the answer from the console.

`public secret(string $question[, bool $fallback = true ]) : mixed`

##### Parameters

$question : string
$fallback : bool = true

#### setInput()

InteractsWithIO.php : 391

Set the input interface implementation.

`public setInput(InputInterface $input) : void`

##### Parameters

$input : InputInterface

#### setOutput()

InteractsWithIO.php : 402

Set the output interface implementation.

`public setOutput(OutputStyle $output) : void`

##### Parameters

$output : OutputStyle

#### table()

InteractsWithIO.php : 224

Format input to textual table.

`public table(array<string|int, mixed> $headers, array<string|int, mixed>|Arrayable $rows[, string|TableStyle $tableStyle = 'default' ][, array<string|int, mixed> $columnStyles = [] ]) : void`

##### Parameters

$headers : array<string|int, mixed>
$rows : array<string|int, mixed>|Arrayable
$tableStyle : string|TableStyle = 'default'
$columnStyles : array<string|int, mixed> = []

#### warn()

InteractsWithIO.php : 343

Write a string as warning output.

`public warn(string $string[, int|string|null $verbosity = null ]) : void`

##### Parameters

$string : string
$verbosity : int|string|null = null

#### withProgressBar()

InteractsWithIO.php : 248

Execute a given callback while advancing a progress bar.

`public withProgressBar(iterable<string|int, mixed>|int $totalSteps, Closure $callback) : int|iterable<string|int, mixed>|void`

##### Parameters

$totalSteps : iterable<string|int, mixed>|int
$callback : Closure

##### Return values

int|iterable<string|int, mixed>|void

#### availableAt()

InteractsWithTime.php : 34

Get the "available at" UNIX timestamp.

`protected availableAt([DateInterval|DateTimeInterface|int $delay = 0 ]) : int`

##### Parameters

$delay : DateInterval|DateTimeInterface|int = 0

##### Return values

int

#### context()

CallsCommands.php : 99

Get all of the context passed to the command.

`protected context() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### createInputFromArguments()

CallsCommands.php : 85

Create an input instance from the given arguments.

`protected createInputFromArguments(array<string|int, mixed> $arguments) : ArrayInput`

##### Parameters

$arguments : array<string|int, mixed>

##### Return values

ArrayInput

#### currentTime()

InteractsWithTime.php : 63

Get the current system time as a UNIX timestamp.

`protected currentTime() : int`

##### Return values

int

#### execute()

BaseCommand.php : 164

Execute the console command.

`protected execute(InputInterface $input, OutputInterface $output) : int`

##### Parameters

$input : InputInterface
$output : OutputInterface

##### Return values

int

#### getArguments()

HasParameters.php : 38

Get the console command arguments.

`protected getArguments() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### getHostAndPort()

StartServer.php : 115

Get the host and port from the host option string.

`protected getHostAndPort() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### getOptions()

StartServer.php : 148

Get the console command options.

`protected getOptions() : array<string|int, mixed>`

##### Return values

array<string|int, mixed>

#### handle()

StartServer.php : 70
`protected handle([int|null $port = null ]) : int`

##### Parameters

$port : int|null = null

##### Return values

int

#### host()

StartServer.php : 137

Get the host for the command.

`protected host() : string`

##### Return values

string

#### parseDateInterval()

InteractsWithTime.php : 49

If the given value is an interval, convert it to a DateTime instance.

`protected parseDateInterval(DateInterval|DateTimeInterface|int $delay) : DateInterval|DateTimeInterface|int`

##### Parameters

$delay : DateInterval|DateTimeInterface|int

##### Return values

DateInterval|DateTimeInterface|int

#### parseVerbosity()

InteractsWithIO.php : 424

Get the verbosity level in terms of Symfony's OutputInterface level.

`protected parseVerbosity([int|string|null $level = null ]) : int`

##### Parameters

$level : int|string|null = null

##### Return values

int

#### resolveCommand()

CallsCommands.php : 19

Resolve the console command instance for the given command.

`protected abstract resolveCommand(string|Command $command) : Command`

##### Parameters

$command : string|Command

##### Return values

Command

#### runCommand()

CallsCommands.php : 66

Run the given the console command.

`protected runCommand(Command|string $command, array<string|int, mixed> $arguments, OutputInterface $output) : int`

##### Parameters

$command : Command|string
$arguments : array<string|int, mixed>
$output : OutputInterface

##### Tags

throws
  ExceptionInterface

##### Return values

int

#### runTimeForHumans()

InteractsWithTime.php : 76

Given a start time, format the total run time for human readability.

`protected runTimeForHumans(float $startTime[, float|null $endTime = null ]) : string`

##### Parameters

$startTime : float
$endTime : float|null = null

##### Tags

throws
  Exception

##### Return values

string

#### secondsUntil()

InteractsWithTime.php : 19

Get the number of seconds until the given DateTime.

`protected secondsUntil(DateInterval|DateTimeInterface|int $delay) : int`

##### Parameters

$delay : DateInterval|DateTimeInterface|int

##### Return values

int

#### serverCommand()

StartServer.php : 96

Get the full server command.

`protected serverCommand( $port, $host) : array<string|int, mixed>`

##### Parameters

$port :
$host :

##### Return values

array<string|int, mixed>

#### setVerbosity()

InteractsWithIO.php : 413

Set the verbosity level.

`protected setVerbosity(int|string $level) : void`

##### Parameters

$level : int|string

#### specifyParameters()

HasParameters.php : 13

Specify the arguments and options on the command.

`protected specifyParameters() : void`

#### port()

StartServer.php : 59

The port on which to run the server.

`private port() : int`

If not passed thru the args, will find it in the settings, otherwise will fallback to 8000

##### Return values

int

#### setApp()

BaseCommand.php : 156
`private setApp(PioniaApplication|null $app) : void`

##### Parameters

$app : PioniaApplication|null

## Search results