StringContent
in package
implements
IHttpContent
Represents string body content for a HTTP message.
Table of Contents
Interfaces
- IHttpContent
- Represents the body content for a HTTP message.
Methods
- __construct() : mixed
- __toString() : string
- fromFile() : StringContent
- Creates an instance from a file.
- fromObject() : StringContent
- Creates an instance an existing object.
- fromRequest() : StringContent
- Creates an instance from the raw request body.
- getString() : string
- Retrieves the underlying string.
Methods
__construct()
public
__construct(string $string) : mixed
Parameters
- $string : string
-
String that represents this message body.
__toString()
public
__toString() : string
Return values
stringfromFile()
Creates an instance from a file.
public
static fromFile(string $path) : StringContent
Parameters
- $path : string
-
Path to the file.
Return values
StringContent —Instance representing the provided path.
fromObject()
Creates an instance an existing object.
public
static fromObject(Stringable|string $string) : StringContent
Parameters
- $string : Stringable|string
-
Object to cast to a string.
Return values
StringContent —Instance representing the provided object.
fromRequest()
Creates an instance from the raw request body.
public
static fromRequest() : StringContent
Return values
StringContent —Instance representing the request body.
getString()
Retrieves the underlying string.
public
getString() : string
Return values
string —Underlying string.