The serializer instance to encode/decode messages.
projectId
string
The current Project ID.
name
string
The snapshot name.
encode
bool
Whether certain request arguments should be base64-encoded.
info
array
[optional] The snapshot data. When creating a
Snapshot, this arraymustcontain a$info.subscriptionargument with a fully-qualified subscription name.
clientConfig
array
[optional] Configuration options for the
PubSub client used to handle processing of batch items through the
daemon. For valid options please seePubSubClient::__construct().Defaults to* the options provided to the PubSub client
associated with this instance.
name
Get the Snapshot name.
Example:
echo $snapshot->name();
Returns
Type
Description
string
info
Get the snapshot info.
Example:
$info = $snapshot->info();
Returns
Type
Description
array
create
Create a new Snapshot.
When creating a snapshot, a subscription name must be supplied at
instantiation.
Please note that this method may not yet be available in your project.
Example:
$info = $snapshot->create();
Parameter
Name
Description
options
array
[optional] Configuration options.
Returns
Type
Description
array
delete
Delete the snapshot.
Please note that this method may not yet be available in your project.
Example:
$snapshot->delete();
Parameter
Name
Description
options
array
[optional] Configuration options.
Returns
Type
Description
void
topic
Get the Topic attached to the snapshot, if one exists.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud PubSub Client - Class Snapshot (2.13.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.13.2 (latest)](/php/docs/reference/cloud-pubsub/latest/Snapshot)\n- [2.13.1](/php/docs/reference/cloud-pubsub/2.13.1/Snapshot)\n- [2.12.0](/php/docs/reference/cloud-pubsub/2.12.0/Snapshot)\n- [2.11.3](/php/docs/reference/cloud-pubsub/2.11.3/Snapshot)\n- [2.10.1](/php/docs/reference/cloud-pubsub/2.10.1/Snapshot)\n- [2.9.1](/php/docs/reference/cloud-pubsub/2.9.1/Snapshot)\n- [2.8.2](/php/docs/reference/cloud-pubsub/2.8.2/Snapshot)\n- [2.7.0](/php/docs/reference/cloud-pubsub/2.7.0/Snapshot)\n- [2.6.0](/php/docs/reference/cloud-pubsub/2.6.0/Snapshot)\n- [2.5.2](/php/docs/reference/cloud-pubsub/2.5.2/Snapshot)\n- [2.4.0](/php/docs/reference/cloud-pubsub/2.4.0/Snapshot)\n- [2.3.0](/php/docs/reference/cloud-pubsub/2.3.0/Snapshot)\n- [2.2.1](/php/docs/reference/cloud-pubsub/2.2.1/Snapshot)\n- [2.1.2](/php/docs/reference/cloud-pubsub/2.1.2/Snapshot)\n- [1.50.0](/php/docs/reference/cloud-pubsub/1.50.0/Snapshot)\n- [1.49.0](/php/docs/reference/cloud-pubsub/1.49.0/Snapshot)\n- [1.48.0](/php/docs/reference/cloud-pubsub/1.48.0/Snapshot)\n- [1.47.0](/php/docs/reference/cloud-pubsub/1.47.0/Snapshot)\n- [1.46.5](/php/docs/reference/cloud-pubsub/1.46.5/Snapshot)\n- [1.45.2](/php/docs/reference/cloud-pubsub/1.45.2/Snapshot)\n- [1.44.0](/php/docs/reference/cloud-pubsub/1.44.0/Snapshot)\n- [1.43.2](/php/docs/reference/cloud-pubsub/1.43.2/Snapshot)\n- [1.42.1](/php/docs/reference/cloud-pubsub/1.42.1/Snapshot)\n- [1.41.3](/php/docs/reference/cloud-pubsub/1.41.3/Snapshot)\n- [1.40.1](/php/docs/reference/cloud-pubsub/1.40.1/Snapshot)\n- [1.39.3](/php/docs/reference/cloud-pubsub/1.39.3/Snapshot) \nReference documentation and code samples for the Cloud PubSub Client class Snapshot.\n\nRepresents a Pub/Sub Snapshot\n\nExample: \n\n use Google\\Cloud\\PubSub\\PubSubClient;\n\n $pubsub = new PubSubClient(['projectId' =\u003e 'my-project']);\n\n $snapshot = $pubsub-\u003esnapshot($snapshotName);\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ PubSub\n\nMethods\n-------\n\n### __construct\n\n### name\n\nGet the Snapshot name.\n\nExample: \n\n echo $snapshot-\u003ename();\n\n### info\n\nGet the snapshot info.\n\nExample: \n\n $info = $snapshot-\u003einfo();\n\n### create\n\nCreate a new Snapshot.\n\nWhen creating a snapshot, a subscription name must be supplied at\ninstantiation.\n\nPlease note that this method may not yet be available in your project.\n\nExample: \n\n $info = $snapshot-\u003ecreate();\n\n### delete\n\nDelete the snapshot.\n\nPlease note that this method may not yet be available in your project.\n\nExample: \n\n $snapshot-\u003edelete();\n\n### topic\n\nGet the Topic attached to the snapshot, if one exists.\n\nExample: \n\n $topic = $snapshot-\u003etopic();\n\n### subscription\n\nGet the Subscription attached to the snapshot, if one exists.\n\nExample: \n\n $subscription = $snapshot-\u003esubscription();\n\n### __debugInfo"]]