PHP Class Google\Cloud\Datastore\Blob

Blobs can be used to store binary data in Google Cloud Datastore. Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $datastore = $cloud->datastore(); $blob = $datastore->blob(file_get_contents(__DIR__ .'/family-photo.jpg')); Get the value of a blob by casting to a string. echo (string) $blob;
Mostra file Open project: GoogleCloudPlatform/gcloud-php Class Usage Examples

Public Methods

Method Description
__construct ( string | resource | Psr\Http\Message\StreamInterface $value ) Create a blob
__toString ( ) : string Cast the blob to a string
get ( ) : Psr\Http\Message\StreamInterface Get the blob contents as a stream

Method Details

__construct() public method

Create a blob
public __construct ( string | resource | Psr\Http\Message\StreamInterface $value )
$value string | resource | Psr\Http\Message\StreamInterface The blob value

__toString() public method

Cast the blob to a string
public __toString ( ) : string
return string

get() public method

Example: $value = $blob->get();
public get ( ) : Psr\Http\Message\StreamInterface
return Psr\Http\Message\StreamInterface