PHP Class System\Response

Afficher le fichier Open project: rwarasaurus/nano Class Usage Examples

Méthodes publiques

Свойство Type Description
$headers array Array of headers to be sent
$output string The final output
$status integer The response status

Méthodes publiques

Méthode Description
__construct ( $output, $status = 200, $headers = [] ) Create a new instance of the Response class
create ( $output, $status = 200, $headers = [] ) : object Create a new instance of the Response class for chaining
json ( $output, $status = 200 ) : object Creates a response with the output as JSON
redirect ( $uri, $status = 302 ) : object Creates a response with a header to redirect
send ( ) Sends the final headers cookies and output

Method Details

__construct() public méthode

Create a new instance of the Response class
public __construct ( $output, $status = 200, $headers = [] )

create() public static méthode

Create a new instance of the Response class for chaining
public static create ( $output, $status = 200, $headers = [] ) : object
Résultat object

json() public static méthode

Creates a response with the output as JSON
public static json ( $output, $status = 200 ) : object
Résultat object

redirect() public static méthode

Creates a response with a header to redirect
public static redirect ( $uri, $status = 302 ) : object
Résultat object

send() public méthode

Sends the final headers cookies and output
public send ( )

Property Details

$headers public_oe property

Array of headers to be sent
public array $headers
Résultat array

$output public_oe property

The final output
public string $output
Résultat string

$status public_oe property

The response status
public int $status
Résultat integer