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

Namespaces

  • Aws
    • AccessAnalyzer
      • Exception
    • Account
      • Exception
    • Acm
      • Exception
    • ACMPCA
      • Exception
    • AlexaForBusiness
      • Exception
    • Amplify
      • Exception
    • AmplifyBackend
      • Exception
    • AmplifyUIBuilder
      • Exception
    • Api
      • ErrorParser
      • Parser
        • Exception
      • Serializer
    • ApiGateway
      • Exception
    • ApiGatewayManagementApi
      • Exception
    • ApiGatewayV2
      • Exception
    • AppConfig
      • Exception
    • AppConfigData
      • Exception
    • Appflow
      • Exception
    • AppIntegrationsService
      • Exception
    • ApplicationAutoScaling
      • Exception
    • ApplicationCostProfiler
      • Exception
    • ApplicationDiscoveryService
      • Exception
    • ApplicationInsights
      • Exception
    • AppMesh
      • Exception
    • AppRegistry
      • Exception
    • AppRunner
      • Exception
    • Appstream
      • Exception
    • AppSync
      • Exception
    • ARCZonalShift
      • Exception
    • Arn
      • Exception
    • Athena
      • Exception
    • AuditManager
      • Exception
    • AugmentedAIRuntime
      • Exception
    • AutoScaling
      • Exception
    • AutoScalingPlans
      • Exception
    • Backup
      • Exception
    • BackupGateway
      • Exception
    • BackupStorage
      • Exception
    • Batch
      • Exception
    • BillingConductor
      • Exception
    • Braket
      • Exception
    • Budgets
      • Exception
    • Chime
      • Exception
    • ChimeSDKIdentity
      • Exception
    • ChimeSDKMediaPipelines
      • Exception
    • ChimeSDKMeetings
      • Exception
    • ChimeSDKMessaging
      • Exception
    • ChimeSDKVoice
      • Exception
    • CleanRooms
      • Exception
    • ClientSideMonitoring
      • Exception
    • Cloud9
      • Exception
    • CloudControlApi
      • Exception
    • CloudDirectory
      • Exception
    • CloudFormation
      • Exception
    • CloudFront
      • Exception
    • CloudHsm
      • Exception
    • CloudHSMV2
      • Exception
    • CloudSearch
      • Exception
    • CloudSearchDomain
      • Exception
    • CloudTrail
      • Exception
    • CloudTrailData
      • Exception
    • CloudWatch
      • Exception
    • CloudWatchEvents
      • Exception
    • CloudWatchEvidently
      • Exception
    • CloudWatchLogs
      • Exception
    • CloudWatchRUM
      • Exception
    • CodeArtifact
      • Exception
    • CodeBuild
      • Exception
    • CodeCatalyst
      • 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
    • ConnectCampaignService
      • Exception
    • ConnectCases
      • Exception
    • ConnectContactLens
      • Exception
    • ConnectParticipant
      • Exception
    • ConnectWisdomService
      • Exception
    • ControlTower
      • Exception
    • CostandUsageReportService
      • Exception
    • CostExplorer
      • Exception
    • Credentials
    • Crypto
      • Cipher
      • Polyfill
    • CustomerProfiles
      • Exception
    • DatabaseMigrationService
      • Exception
    • DataExchange
      • Exception
    • DataPipeline
      • Exception
    • DataSync
      • Exception
    • DAX
      • Exception
    • DefaultsMode
      • Exception
    • Detective
      • Exception
    • DeviceFarm
      • Exception
    • DevOpsGuru
      • Exception
    • DirectConnect
      • Exception
    • DirectoryService
      • Exception
    • DLM
      • Exception
    • DocDB
      • Exception
    • DocDBElastic
      • Exception
    • drs
      • 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
    • EMRServerless
      • Exception
    • Endpoint
      • UseDualstackEndpoint
        • Exception
      • UseFipsEndpoint
        • Exception
    • EndpointDiscovery
      • Exception
    • EndpointV2
      • Rule
      • Ruleset
    • EventBridge
      • Exception
    • Exception
    • finspace
      • Exception
    • FinSpaceData
      • Exception
    • Firehose
      • Exception
    • FIS
      • Exception
    • FMS
      • Exception
    • ForecastQueryService
      • Exception
    • ForecastService
      • Exception
    • FraudDetector
      • Exception
    • FSx
      • Exception
    • GameLift
      • Exception
    • GameSparks
      • 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
    • Inspector2
      • Exception
    • Iot
      • Exception
    • IoT1ClickDevicesService
      • Exception
    • IoT1ClickProjects
      • Exception
    • IoTAnalytics
      • Exception
    • IotDataPlane
      • Exception
    • IoTDeviceAdvisor
      • Exception
    • IoTEvents
      • Exception
    • IoTEventsData
      • Exception
    • IoTFleetHub
      • Exception
    • IoTFleetWise
      • Exception
    • IoTJobsDataPlane
      • Exception
    • IoTRoboRunner
      • Exception
    • IoTSecureTunneling
      • Exception
    • IoTSiteWise
      • Exception
    • IoTThingsGraph
      • Exception
    • IoTTwinMaker
      • Exception
    • IoTWireless
      • Exception
    • IVS
      • Exception
    • ivschat
      • Exception
    • Kafka
      • Exception
    • KafkaConnect
      • Exception
    • kendra
      • Exception
    • KendraRanking
      • Exception
    • Keyspaces
      • Exception
    • Kinesis
      • Exception
    • KinesisAnalytics
      • Exception
    • KinesisAnalyticsV2
      • Exception
    • KinesisVideo
      • Exception
    • KinesisVideoArchivedMedia
      • Exception
    • KinesisVideoMedia
      • Exception
    • KinesisVideoSignalingChannels
      • Exception
    • KinesisVideoWebRTCStorage
      • Exception
    • Kms
      • Exception
    • LakeFormation
      • Exception
    • Lambda
      • Exception
    • LexModelBuildingService
      • Exception
    • LexModelsV2
      • Exception
    • LexRuntimeService
      • Exception
    • LexRuntimeV2
      • Exception
    • LicenseManager
      • Exception
    • LicenseManagerLinuxSubscriptions
      • Exception
    • LicenseManagerUserSubscriptions
      • Exception
    • Lightsail
      • Exception
    • LocationService
      • Exception
    • LookoutEquipment
      • Exception
    • LookoutforVision
      • Exception
    • LookoutMetrics
      • Exception
    • MachineLearning
      • Exception
    • Macie
      • Exception
    • Macie2
      • Exception
    • MainframeModernization
      • Exception
    • ManagedBlockchain
      • Exception
    • ManagedGrafana
      • 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
    • MemoryDB
      • Exception
    • mgn
      • Exception
    • MigrationHub
      • Exception
    • MigrationHubConfig
      • Exception
    • MigrationHubOrchestrator
      • Exception
    • MigrationHubRefactorSpaces
      • Exception
    • MigrationHubStrategyRecommendations
      • Exception
    • Mobile
      • Exception
    • MQ
      • Exception
    • MTurk
      • Exception
    • Multipart
    • MWAA
      • Exception
    • Neptune
      • Exception
    • NetworkFirewall
      • Exception
    • NetworkManager
      • Exception
    • NimbleStudio
      • Exception
    • OAM
      • Exception
    • Omics
      • Exception
    • OpenSearchServerless
      • Exception
    • OpenSearchService
      • Exception
    • OpsWorks
      • Exception
    • OpsWorksCM
      • Exception
    • Organizations
      • Exception
    • Outposts
      • Exception
    • Panorama
      • Exception
    • Personalize
      • Exception
    • PersonalizeEvents
      • Exception
    • PersonalizeRuntime
      • Exception
    • PI
      • Exception
    • Pinpoint
      • Exception
    • PinpointEmail
      • Exception
    • PinpointSMSVoice
      • Exception
    • PinpointSMSVoiceV2
      • Exception
    • Pipes
      • Exception
    • Polly
      • Exception
    • Pricing
      • Exception
    • PrivateNetworks
      • Exception
    • PrometheusService
      • Exception
    • Proton
      • Exception
    • QLDB
      • Exception
    • QLDBSession
      • Exception
    • QuickSight
      • Exception
    • RAM
      • Exception
    • Rds
      • Exception
    • RDSDataService
      • Exception
    • RecycleBin
      • Exception
    • Redshift
      • Exception
    • RedshiftDataAPIService
      • Exception
    • RedshiftServerless
      • Exception
    • Rekognition
      • Exception
    • ResilienceHub
      • Exception
    • ResourceExplorer2
      • Exception
    • ResourceGroups
      • Exception
    • ResourceGroupsTaggingAPI
      • Exception
    • Retry
      • Exception
    • RoboMaker
      • Exception
    • RolesAnywhere
      • Exception
    • Route53
      • Exception
    • Route53Domains
      • Exception
    • Route53RecoveryCluster
      • Exception
    • Route53RecoveryControlConfig
      • Exception
    • Route53RecoveryReadiness
      • Exception
    • Route53Resolver
      • Exception
    • S3
      • Crypto
      • Exception
      • RegionalEndpoint
        • Exception
      • UseArnRegion
        • Exception
    • S3Control
      • Exception
    • S3Outposts
      • Exception
    • SageMaker
      • Exception
    • SagemakerEdgeManager
      • Exception
    • SageMakerFeatureStoreRuntime
      • Exception
    • SageMakerGeospatial
      • Exception
    • SageMakerMetrics
      • Exception
    • SageMakerRuntime
      • Exception
    • SavingsPlans
      • Exception
    • Scheduler
      • Exception
    • Schemas
      • Exception
    • Script
      • Composer
    • SecretsManager
      • Exception
    • SecurityHub
      • Exception
    • SecurityLake
      • Exception
    • ServerlessApplicationRepository
      • Exception
    • ServiceCatalog
      • Exception
    • ServiceDiscovery
      • Exception
    • ServiceQuotas
      • Exception
    • Ses
      • Exception
    • SesV2
      • Exception
    • Sfn
      • Exception
    • Shield
      • Exception
    • Signature
    • signer
      • Exception
    • SimSpaceWeaver
      • Exception
    • Sms
      • Exception
    • SnowBall
      • Exception
    • SnowDeviceManagement
      • Exception
    • Sns
      • Exception
    • Sqs
      • Exception
    • Ssm
      • Exception
    • SSMContacts
      • Exception
    • SSMIncidents
      • Exception
    • SsmSap
      • Exception
    • SSO
      • Exception
    • SSOAdmin
      • Exception
    • SSOOIDC
      • Exception
    • StorageGateway
      • Exception
    • Sts
      • Exception
      • RegionalEndpoints
        • Exception
    • Support
      • Exception
    • SupportApp
      • Exception
    • Swf
      • Exception
    • Synthetics
      • Exception
    • Textract
      • Exception
    • TimestreamQuery
      • Exception
    • TimestreamWrite
      • Exception
    • Token
    • TranscribeService
      • Exception
    • Transfer
      • Exception
    • Translate
      • Exception
    • VoiceID
      • Exception
    • Waf
      • Exception
    • WafRegional
      • Exception
    • WAFV2
      • Exception
    • WellArchitected
      • Exception
    • WorkDocs
      • Exception
    • WorkLink
      • Exception
    • WorkMail
      • Exception
    • WorkMailMessageFlow
      • Exception
    • WorkSpaces
      • Exception
    • WorkSpacesWeb
      • Exception
    • XRay
      • Exception
  • GuzzleHttp
    • Promise
    • Psr7
  • Psr
    • Http
      • Message

Classes

  • BatchDelete
  • GetBucketLocationParser
  • MultipartUploader
  • ObjectCopier
  • ObjectUploader
  • PostObject
  • PostObjectV4
  • S3Client
  • S3MultiRegionClient
  • S3UriParser
  • StreamWrapper
  • Transfer
  • ValidateResponseChecksumParser

Interfaces

  • S3ClientInterface

Traits

  • CalculatesChecksumTrait
  • MultipartUploadingTrait
  • S3ClientTrait

Class StreamWrapper

Amazon S3 stream wrapper to use "s3:///" files with PHP streams, supporting "r", "w", "a", "x".

Opening "r" (read only) streams:

Read only streams are truly streaming by default and will not allow you to seek. This is because data read from the stream is not kept in memory or on the local filesystem. You can force a "r" stream to be seekable by setting the "seekable" stream context option true. This will allow true streaming of data from Amazon S3, but will maintain a buffer of previously read bytes in a 'php://temp' stream to allow seeking to previously read bytes from the stream.

You may pass any GetObject parameters as 's3' stream context options. These options will affect how the data is downloaded from Amazon S3.

Opening "w" and "x" (write only) streams:

Because Amazon S3 requires a Content-Length header, write only streams will maintain a 'php://temp' stream to buffer data written to the stream until the stream is flushed (usually by closing the stream with fclose).

You may pass any PutObject parameters as 's3' stream context options. These options will affect how the data is uploaded to Amazon S3.

When opening an "x" stream, the file must exist on Amazon S3 for the stream to open successfully.

Opening "a" (write only append) streams:

Similar to "w" streams, opening append streams requires that the data be buffered in a "php://temp" stream. Append streams will attempt to download the contents of an object in Amazon S3, seek to the end of the object, then allow you to append to the contents of the object. The data will then be uploaded using a PutObject operation when the stream is flushed (usually with fclose).

You may pass any GetObject and/or PutObject parameters as 's3' stream context options. These options will affect how the data is downloaded and uploaded from Amazon S3.

Stream context options:

  • "seekable": Set to true to create a seekable "r" (read only) stream by using a php://temp stream buffer
  • For "unlink" only: Any option that can be passed to the DeleteObject operation

Methods Summary

  • static register ( Aws\S3\S3ClientInterface $client, string $protocol = 's3', Aws\CacheInterface $cache = null, $v2Existence = false )

    Register the 's3://' stream wrapper

  • stream_close ( )
  • stream_open ( $path, $mode, $options, & $opened_path )
  • stream_eof ( )
  • stream_flush ( )
  • stream_read ( $count )
  • stream_seek ( $offset, $whence = SEEK_SET )
  • stream_tell ( )
  • stream_write ( $data )
  • unlink ( $path )
  • stream_stat ( )
  • url_stat ( $path, $flags )

    Provides information for is_dir, is_file, filesize, etc. Works on buckets, keys, and prefixes.

  • mkdir ( string $path, int $mode, int $options )

    Support for mkdir().

  • rmdir ( $path, $options )
  • dir_opendir ( string $path, string $options )

    Support for opendir().

  • dir_closedir ( )

    Close the directory listing handles

  • dir_rewinddir ( )

    This method is called in response to rewinddir()

  • dir_readdir ( )

    This method is called in response to readdir()

  • rename ( string $path_from, string $path_to )

    Called in response to rename() to rename a file or directory. Currently only supports renaming objects.

  • stream_cast ( $cast_as )

Methods Details

static register ( Aws\S3\S3ClientInterface $client, string $protocol = 's3', Aws\CacheInterface $cache = null, $v2Existence = false )

Register the 's3://' stream wrapper

Parameters

Aws\S3\S3ClientInterface $client Client to use with the stream wrapper
string $protocol = 's3' Protocol to register as.
Aws\CacheInterface $cache = null Default cache for the protocol.
$v2Existence = false

stream_close ( )

stream_open ( $path, $mode, $options, & $opened_path )

stream_eof ( )

stream_flush ( )

stream_read ( $count )

stream_seek ( $offset, $whence = SEEK_SET )

stream_tell ( )

stream_write ( $data )

unlink ( $path )

stream_stat ( )

url_stat ( $path, $flags )

Provides information for is_dir, is_file, filesize, etc. Works on buckets, keys, and prefixes.

Link

http://www.php.net/manual/en/streamwrapper.url-stat.php

boolean mkdir ( string $path, integer $mode, integer $options )

Support for mkdir().

Parameters

string $path Directory which should be created.
integer $mode

Permissions. 700-range permissions map to ACL_PUBLIC. 600-range permissions map to ACL_AUTH_READ. All other permissions map to ACL_PRIVATE. Expects octal form.

integer $options

A bitwise mask of values, such as STREAM_MKDIR_RECURSIVE.

Returns

boolean

Link

http://www.php.net/manual/en/streamwrapper.mkdir.php

rmdir ( $path, $options )

boolean dir_opendir ( string $path, string $options )

Support for opendir().

The opendir() method of the Amazon S3 stream wrapper supports a stream context option of "listFilter". listFilter must be a callable that accepts an associative array of object data and returns true if the object should be yielded when iterating the keys in a bucket.

Parameters

string $path

The path to the directory (e.g. "s3://dir[]")

string $options Unused option variable

Returns

boolean
true on success

See

http://www.php.net/manual/en/function.opendir.php

boolean dir_closedir ( )

Close the directory listing handles

Returns

boolean
true on success

boolean dir_rewinddir ( )

This method is called in response to rewinddir()

Returns

boolean
true on success

string dir_readdir ( )

This method is called in response to readdir()

Returns

string

Should return a string representing the next filename, or false if there is no next file.

Link

http://www.php.net/manual/en/function.readdir.php

boolean rename ( string $path_from, string $path_to )

Called in response to rename() to rename a file or directory. Currently only supports renaming objects.

Parameters

string $path_from the path to the file to rename
string $path_to the new path to the file

Returns

boolean
true if file was successfully renamed

Link

http://www.php.net/manual/en/function.rename.php

stream_cast ( $cast_as )

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