AWS SDK for PHP 3.x
  • Namespace
  • Class
Did this page help you? SUBMIT FEEDBACK!

Namespaces

  • Aws
    • AccessAnalyzer
      • Exception
    • Acm
      • Exception
    • ACMPCA
      • Exception
    • AlexaForBusiness
      • Exception
    • Amplify
      • Exception
    • AmplifyBackend
      • Exception
    • Api
      • ErrorParser
      • Parser
        • Exception
      • Serializer
    • ApiGateway
      • Exception
    • ApiGatewayManagementApi
      • Exception
    • ApiGatewayV2
      • Exception
    • AppConfig
      • Exception
    • Appflow
      • Exception
    • AppIntegrationsService
      • Exception
    • ApplicationAutoScaling
      • Exception
    • ApplicationDiscoveryService
      • Exception
    • ApplicationInsights
      • Exception
    • AppMesh
      • Exception
    • AppRegistry
      • Exception
    • Appstream
      • Exception
    • AppSync
      • Exception
    • Arn
      • Exception
    • Athena
      • Exception
    • AuditManager
      • Exception
    • AugmentedAIRuntime
      • Exception
    • AutoScaling
      • Exception
    • AutoScalingPlans
      • Exception
    • Backup
      • Exception
    • Batch
      • Exception
    • Braket
      • Exception
    • Budgets
      • Exception
    • Chime
      • Exception
    • ClientSideMonitoring
      • Exception
    • Cloud9
      • Exception
    • CloudDirectory
      • Exception
    • CloudFormation
      • Exception
    • CloudFront
      • Exception
    • CloudHsm
      • Exception
    • CloudHSMV2
      • Exception
    • CloudSearch
      • Exception
    • CloudSearchDomain
      • Exception
    • CloudTrail
      • Exception
    • CloudWatch
      • Exception
    • CloudWatchEvents
      • Exception
    • CloudWatchLogs
      • Exception
    • CodeArtifact
      • Exception
    • CodeBuild
      • Exception
    • CodeCommit
      • Exception
    • CodeDeploy
      • Exception
    • CodeGuruProfiler
      • Exception
    • CodeGuruReviewer
      • Exception
    • CodePipeline
      • Exception
    • CodeStar
      • Exception
    • CodeStarconnections
      • Exception
    • CodeStarNotifications
      • Exception
    • CognitoIdentity
      • Exception
    • CognitoIdentityProvider
      • Exception
    • CognitoSync
      • Exception
    • Comprehend
      • Exception
    • ComprehendMedical
      • Exception
    • ComputeOptimizer
      • Exception
    • ConfigService
      • Exception
    • Connect
      • Exception
    • ConnectContactLens
      • Exception
    • ConnectParticipant
      • Exception
    • CostandUsageReportService
      • Exception
    • CostExplorer
      • Exception
    • Credentials
    • Crypto
      • Cipher
      • Polyfill
    • CustomerProfiles
      • Exception
    • DatabaseMigrationService
      • Exception
    • DataExchange
      • Exception
    • DataPipeline
      • Exception
    • DataSync
      • Exception
    • DAX
      • Exception
    • Detective
      • Exception
    • DeviceFarm
      • Exception
    • DevOpsGuru
      • Exception
    • DirectConnect
      • Exception
    • DirectoryService
      • Exception
    • DLM
      • Exception
    • DocDB
      • Exception
    • DynamoDb
      • Exception
    • DynamoDbStreams
      • Exception
    • EBS
      • Exception
    • Ec2
      • Exception
    • EC2InstanceConnect
      • Exception
    • Ecr
      • Exception
    • ECRPublic
      • Exception
    • Ecs
      • Exception
    • Efs
      • Exception
    • EKS
      • Exception
    • ElastiCache
      • Exception
    • ElasticBeanstalk
      • Exception
    • ElasticInference
      • Exception
    • ElasticLoadBalancing
      • Exception
    • ElasticLoadBalancingV2
      • Exception
    • ElasticsearchService
      • Exception
    • ElasticTranscoder
      • Exception
    • Emr
      • Exception
    • EMRContainers
      • Exception
    • Endpoint
    • EndpointDiscovery
      • Exception
    • EventBridge
      • Exception
    • Exception
    • Firehose
      • Exception
    • FIS
      • Exception
    • FMS
      • Exception
    • ForecastQueryService
      • Exception
    • ForecastService
      • Exception
    • FraudDetector
      • Exception
    • FSx
      • Exception
    • GameLift
      • Exception
    • Glacier
      • Exception
    • GlobalAccelerator
      • Exception
    • Glue
      • Exception
    • GlueDataBrew
      • Exception
    • Greengrass
      • Exception
    • GreengrassV2
      • Exception
    • GroundStation
      • Exception
    • GuardDuty
      • Exception
    • Handler
      • GuzzleV5
      • GuzzleV6
    • Health
      • Exception
    • HealthLake
      • Exception
    • Honeycode
      • Exception
    • Iam
      • Exception
    • IdentityStore
      • Exception
    • imagebuilder
      • Exception
    • ImportExport
      • Exception
    • Inspector
      • Exception
    • Iot
      • Exception
    • IoT1ClickDevicesService
      • Exception
    • IoT1ClickProjects
      • Exception
    • IoTAnalytics
      • Exception
    • IotDataPlane
      • Exception
    • IoTDeviceAdvisor
      • Exception
    • IoTEvents
      • Exception
    • IoTEventsData
      • Exception
    • IoTFleetHub
      • Exception
    • IoTJobsDataPlane
      • Exception
    • IoTSecureTunneling
      • Exception
    • IoTSiteWise
      • Exception
    • IoTThingsGraph
      • Exception
    • IoTWireless
      • Exception
    • IVS
      • Exception
    • Kafka
      • Exception
    • kendra
      • Exception
    • Kinesis
      • Exception
    • KinesisAnalytics
      • Exception
    • KinesisAnalyticsV2
      • Exception
    • KinesisVideo
      • Exception
    • KinesisVideoArchivedMedia
      • Exception
    • KinesisVideoMedia
      • Exception
    • KinesisVideoSignalingChannels
      • Exception
    • Kms
      • Exception
    • LakeFormation
      • Exception
    • Lambda
      • Exception
    • LexModelBuildingService
      • Exception
    • LexModelsV2
      • Exception
    • LexRuntimeService
      • Exception
    • LexRuntimeV2
      • Exception
    • LicenseManager
      • Exception
    • Lightsail
      • Exception
    • LocationService
      • Exception
    • LookoutEquipment
      • Exception
    • LookoutforVision
      • Exception
    • LookoutMetrics
      • Exception
    • MachineLearning
      • Exception
    • Macie
      • Exception
    • Macie2
      • Exception
    • ManagedBlockchain
      • Exception
    • MarketplaceCatalog
      • Exception
    • MarketplaceCommerceAnalytics
      • Exception
    • MarketplaceEntitlementService
      • Exception
    • MarketplaceMetering
      • Exception
    • MediaConnect
      • Exception
    • MediaConvert
      • Exception
    • MediaLive
      • Exception
    • MediaPackage
      • Exception
    • MediaPackageVod
      • Exception
    • MediaStore
      • Exception
    • MediaStoreData
      • Exception
    • MediaTailor
      • Exception
    • mgn
      • Exception
    • MigrationHub
      • Exception
    • MigrationHubConfig
      • Exception
    • Mobile
      • Exception
    • MQ
      • Exception
    • MTurk
      • Exception
    • Multipart
    • MWAA
      • Exception
    • Neptune
      • Exception
    • NetworkFirewall
      • Exception
    • NetworkManager
      • Exception
    • OpsWorks
      • Exception
    • OpsWorksCM
      • Exception
    • Organizations
      • Exception
    • Outposts
      • Exception
    • Personalize
      • Exception
    • PersonalizeEvents
      • Exception
    • PersonalizeRuntime
      • Exception
    • PI
      • Exception
    • Pinpoint
      • Exception
    • PinpointEmail
      • Exception
    • PinpointSMSVoice
      • Exception
    • Polly
      • Exception
    • Pricing
      • Exception
    • PrometheusService
      • Exception
    • QLDB
      • Exception
    • QLDBSession
      • Exception
    • QuickSight
      • Exception
    • RAM
      • Exception
    • Rds
      • Exception
    • RDSDataService
      • Exception
    • Redshift
      • Exception
    • RedshiftDataAPIService
      • Exception
    • Rekognition
      • Exception
    • ResourceGroups
      • Exception
    • ResourceGroupsTaggingAPI
      • Exception
    • Retry
      • Exception
    • RoboMaker
      • Exception
    • Route53
      • Exception
    • Route53Domains
      • Exception
    • Route53Resolver
      • Exception
    • S3
      • Crypto
      • Exception
      • RegionalEndpoint
        • Exception
      • UseArnRegion
        • Exception
    • S3Control
      • Exception
    • S3Outposts
      • Exception
    • SageMaker
      • Exception
    • SagemakerEdgeManager
      • Exception
    • SageMakerFeatureStoreRuntime
      • Exception
    • SageMakerRuntime
      • Exception
    • SavingsPlans
      • Exception
    • Schemas
      • Exception
    • SecretsManager
      • Exception
    • SecurityHub
      • Exception
    • ServerlessApplicationRepository
      • Exception
    • ServiceCatalog
      • Exception
    • ServiceDiscovery
      • Exception
    • ServiceQuotas
      • Exception
    • Ses
      • Exception
    • SesV2
      • Exception
    • Sfn
      • Exception
    • Shield
      • Exception
    • Signature
    • signer
      • Exception
    • Sms
      • Exception
    • SnowBall
      • Exception
    • Sns
      • Exception
    • Sqs
      • Exception
    • Ssm
      • Exception
    • SSO
      • Exception
    • SSOAdmin
      • Exception
    • SSOOIDC
      • Exception
    • StorageGateway
      • Exception
    • Sts
      • Exception
      • RegionalEndpoints
        • Exception
    • Support
      • Exception
    • Swf
      • Exception
    • Synthetics
      • Exception
    • Textract
      • Exception
    • TimestreamQuery
      • Exception
    • TimestreamWrite
      • Exception
    • TranscribeService
      • Exception
    • Transfer
      • Exception
    • Translate
      • Exception
    • Waf
      • Exception
    • WafRegional
      • Exception
    • WAFV2
      • Exception
    • WellArchitected
      • Exception
    • WorkDocs
      • Exception
    • WorkLink
      • Exception
    • WorkMail
      • Exception
    • WorkMailMessageFlow
      • Exception
    • WorkSpaces
      • Exception
    • XRay
      • Exception
  • GuzzleHttp
    • Promise
    • Psr7
  • Psr
    • Http
      • Message

Classes

  • BinaryValue
  • DynamoDbClient
  • LockingSessionConnection
  • Marshaler
  • NumberValue
  • SessionHandler
  • SetValue
  • StandardSessionConnection
  • WriteRequestBatch

Interfaces

  • SessionConnectionInterface

Traits

  • SessionConnectionConfigTrait
AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Class Marshaler

Marshals and unmarshals JSON documents and PHP arrays into DynamoDB items.

Methods Summary

  • __construct ( array $options = [] )

    Instantiates a DynamoDB Marshaler.

  • binary ( mixed $value )

    Creates a special object to represent a DynamoDB binary (B) value.

  • number ( string|int|float $value )

    Creates a special object to represent a DynamoDB number (N) value.

  • set ( array $values )

    Creates a special object to represent a DynamoDB set (SS/NS/BS) value.

  • marshalJson ( string $json )

    Marshal a JSON document from a string to a DynamoDB item.

  • marshalItem ( array|\stdClass $item )

    Marshal a native PHP array of data to a DynamoDB item.

  • marshalValue ( mixed $value )

    Marshal a native PHP value into a DynamoDB attribute value.

  • unmarshalJson ( array $data, int $jsonEncodeFlags = 0 )

    Unmarshal a document (item) from a DynamoDB operation result into a JSON document string.

  • unmarshalItem ( array $data, bool $mapAsObject = false )

    Unmarshal an item from a DynamoDB operation result into a native PHP array. If you set $mapAsObject to true, then a stdClass value will be returned instead.

  • unmarshalValue ( array $value, bool $mapAsObject = false )

    Unmarshal a value from a DynamoDB operation result into a native PHP value. Will return a scalar, array, or (if you set $mapAsObject to true) stdClass value.

Methods Details

__construct ( array $options = [] )

Instantiates a DynamoDB Marshaler.

The following options are valid.

  • ignore_invalid: (bool) Set to true if invalid values should be ignored (i.e., not included) during marshaling.
  • nullify_invalid: (bool) Set to true if invalid values should be set to null.
  • wrap_numbers: (bool) Set to true to wrap numbers with NumberValue objects during unmarshaling to preserve the precision.

Parameters

array $options = [] Marshaler options

Aws\DynamoDb\BinaryValue binary ( mixed $value )

Creates a special object to represent a DynamoDB binary (B) value.

This helps disambiguate binary values from string (S) values.

Parameters

mixed $value A binary value compatible with Guzzle streams.

Returns

Aws\DynamoDb\BinaryValue

See

GuzzleHttp\Stream\Stream::factory

Aws\DynamoDb\NumberValue number ( string|integer|float $value )

Creates a special object to represent a DynamoDB number (N) value.

This helps maintain the precision of large integer/float in PHP.

Parameters

string|integer|float $value A number value.

Returns

Aws\DynamoDb\NumberValue

Aws\DynamoDb\SetValue set ( array $values )

Creates a special object to represent a DynamoDB set (SS/NS/BS) value.

This helps disambiguate set values from list (L) values.

Parameters

array $values The values of the set.

Returns

Aws\DynamoDb\SetValue

array marshalJson ( string $json )

Marshal a JSON document from a string to a DynamoDB item.

The result is an array formatted in the proper parameter structure required by the DynamoDB API for items.

Parameters

string $json A valid JSON document.

Returns

array
Item formatted for DynamoDB.

Exceptions

InvalidArgumentException
if the JSON is invalid.

array marshalItem ( array|stdClass $item )

Marshal a native PHP array of data to a DynamoDB item.

The result is an array formatted in the proper parameter structure required by the DynamoDB API for items.

Parameters

array|stdClass $item An associative array of data.

Returns

array
Item formatted for DynamoDB.

array marshalValue ( mixed $value )

Marshal a native PHP value into a DynamoDB attribute value.

The result is an associative array that is formatted in the proper [TYPE => VALUE] parameter structure required by the DynamoDB API.

Parameters

mixed $value A scalar, array, or stdClass value.

Returns

array
Attribute formatted for DynamoDB.

Exceptions

UnexpectedValueException
if the value cannot be marshaled.

string unmarshalJson ( array $data, integer $jsonEncodeFlags = 0 )

Unmarshal a document (item) from a DynamoDB operation result into a JSON document string.

Parameters

array $data Item/document from a DynamoDB result.
integer $jsonEncodeFlags = 0 Flags to use with json_encode().

Returns

string

array|stdClass unmarshalItem ( array $data, boolean $mapAsObject = false )

Unmarshal an item from a DynamoDB operation result into a native PHP array. If you set $mapAsObject to true, then a stdClass value will be returned instead.

Parameters

array $data Item from a DynamoDB result.
boolean $mapAsObject = false Whether maps should be represented as stdClass.

Returns

array|stdClass

mixed unmarshalValue ( array $value, boolean $mapAsObject = false )

Unmarshal a value from a DynamoDB operation result into a native PHP value. Will return a scalar, array, or (if you set $mapAsObject to true) stdClass value.

Parameters

array $value Value from a DynamoDB result.
boolean $mapAsObject = false Whether maps should be represented as stdClass.

Returns

mixed

Exceptions

UnexpectedValueException
AWS SDK for PHP 3.x API documentation generated by ApiGen