ICanBoogie
  • Documentation
  • API Reference
  • HTTP master
Namespaces
  • ICanBoogie
    • Exception
    • HTTP
      • Headers
      • Request
      • RequestDispatcher
Classes
  • CallableDispatcher
  • DispatcherProvider
  • File
  • FileInfo
  • FileList
  • FileResponse
  • Headers
  • ProvideDispatcher
  • RedirectResponse
  • Request
  • RequestDispatcher
  • RequestOptionsMapper
  • RequestRange
  • Response
  • Status
  • WeightedDispatcher
Interfaces
  • Dispatcher
  • Exception
  • FileOptions
  • RequestMethods
  • RequestOptions
  • ResponseStatus
  • SecurityError
Exceptions
  • AuthenticationRequired
  • ClientError
  • DispatcherNotDefined
  • DispatcherProviderNotDefined
  • ForceRedirect
  • MethodNotSupported
  • NotFound
  • PermissionRequired
  • ServerError
  • ServiceUnavailable
  • StatusCodeNotValid

Class Headers

HTTP Header field definitions.

Instances of this class are used to collect and manipulate HTTP header field definitions. Header field instances are used to handle the definition of complex header fields such as Content-Type and Cache-Control. For instance a ICanBoogie\HTTP\Headers\CacheControl instance is used to handle the directives of the Cache-Control header field.

ICanBoogie\HTTP\Headers implements ArrayAccess, IteratorAggregate
Namespace: ICanBoogie\HTTP
See: http://tools.ietf.org/html/rfc2616#section-14
Located at Headers.php

Methods summary

public __construct( array $fields = [] )

If the REQUEST_URI key is found in the header fields they are considered coming from the super global $_SERVER array in which case they are filtered to keep only keys starting with the HTTP_ prefix. Also, header field names are normalized. For instance, HTTP_CONTENT_TYPE becomes Content-Type.

If the REQUEST_URI key is found in the header fields they are considered coming from the super global $_SERVER array in which case they are filtered to keep only keys starting with the HTTP_ prefix. Also, header field names are normalized. For instance, HTTP_CONTENT_TYPE becomes Content-Type.

Parameters

$fields
The initial headers.
public __clone( void )

Clone instantiated fields.

Clone instantiated fields.

public __toString( void ) : string

Returns the header as a string.

Returns the header as a string.

Header fields with empty string values are discarded.

Returns

string
public __invoke( void )

Sends header fields using the header() function.

Sends header fields using the header() function.

Header fields with empty string values are discarded.

protected send_header( $field, $value )
public offsetExists( mixed $field ) : boolean

Checks if a header field exists.

Checks if a header field exists.

Parameters

$field

Returns

boolean

Implementation of

ArrayAccess::offsetExists()
public offsetGet( mixed $field ) : string|null

Returns a header.

Returns a header.

Parameters

$field

Returns

string|null
The header field value or null if it is not defined.

Implementation of

ArrayAccess::offsetGet()
public offsetSet( string $field, mixed $value )

Sets a header field.

Sets a header field.

Note: Setting a header field to null removes it, just like unset() would.

Date, Expires, Last-Modified

The Date, Expires and Last-Modified header fields can be provided as a Unix timestamp, a string or a \DateTime object.

Cache-Control, Content-Disposition and Content-Type

Instances of the ICanBoogie\HTTP\Headers\CacheControl, ICanBoogie\HTTP\Headers\ContentDisposition and ICanBoogie\HTTP\Headers\ContentType are used to handle the values of the Cache-Control, Content-Disposition and Content-Type header fields.

Parameters

$field
The header field to set.
$value
The value of the header field.

Implementation of

ArrayAccess::offsetSet()
public offsetUnset( mixed $field )

Removes a header field.

Removes a header field.

Parameters

$field

Implementation of

ArrayAccess::offsetUnset()
public getIterator( void )

Returns an iterator for the header fields.

Returns an iterator for the header fields.

Implementation of

IteratorAggregate::getIterator()

Properties summary

protected $fields : array

Header fields.

Header fields.

[]
HTTP master – Check on GitHub – API documentation generated by ApiGen