You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP client SDK for fakecloud — a local AWS cloud emulator.
Provides typed access to the fakecloud introspection and simulation API (/_fakecloud/* endpoints), letting you inspect emulator state and trigger time-based processors in tests.
Requires PHP 8.1+. Uses the built-in curl extension and json_decode/json_encode. No external dependencies.
Installation
composer require fakecloud/fakecloud
Quick start
useFakeCloud\FakeCloud;
$fc = newFakeCloud('http://localhost:4566');
// Check server health$health = $fc->health();
echo$health->version . '' . implode(', ', $health->services);
// Reset all state between tests$fc->reset();
// Inspect SES emails sent during a test$emails = $fc->ses()->getEmails()->emails;
echo'Sent ' . count($emails) . ' emails';
// Inspect SNS messages$messages = $fc->sns()->getMessages()->messages;
// Inspect SQS messages across all queues$queues = $fc->sqs()->getMessages()->queues;
// Advance DynamoDB TTL processor$expired = $fc->dynamodb()->tickTtl()->expiredItems;
// Advance S3 lifecycle processor$expiredObjects = $fc->s3()->tickLifecycle()->expiredObjects;
API reference
FakeCloud
$fc = newFakeCloud(); // defaults to http://localhost:4566$fc = newFakeCloud('http://localhost:4566'); // explicit base URL
Bridge endpoint for the PostgreSQL aws_lambda extension
s3Import($req)
Bridge endpoint for the PostgreSQL aws_s3 extension (S3 -> DB)
s3Export($req)
Bridge endpoint for the PostgreSQL aws_s3 extension (DB -> S3 PutObject)
$fc->elasticache()
Method
Description
getClusters()
List ElastiCache cache clusters
getReplicationGroups()
List ElastiCache replication groups
getServerlessCaches()
List ElastiCache serverless caches
getElastiCacheAcls()
List ElastiCache user ACLs
$fc->ec2()
Method
Description
getInstances()
List EC2 instances with control-plane + runtime metadata
getInstanceNetworks()
Inspect each instance's backing network (Docker/Podman network or k8s NetworkPolicy), container IP, isolation backend, and whether security-group enforcement is active
$fc->ecr()
Method
Description
getRepositories()
List ECR repositories
getImages($repositoryName = null)
List ECR images (optionally per repo)
getPullThroughRules()
List ECR pull-through cache rules
$fc->logs()
Method
Description
injectAnomaly($req)
Inject a CloudWatch Logs anomaly for tests
getDeliveryConfig()
Get the current Logs delivery config snapshot
getFieldIndexes($logGroupName)
Get configured field indexes for a log group
$fc->ses()
Method
Description
getEmails()
List all sent emails
simulateInbound($req)
Simulate an inbound email (drive receipt rules)
getMetrics()
Get SES send/bounce/complaint metrics
setMailFromStatus($identity, $status)
Force a MAIL FROM domain verification status
getDkimPublicKey($identity)
Get the simulated DKIM public key for an identity
setSandbox($sandbox)
Toggle sandbox mode for the account
getBounces()
List recorded SES bounce events
getMessageInsights($messageId)
Get SES message insights for a sent message
getSmtpSubmissions()
List messages submitted via the SMTP submission endpoint
getEventDestinationDeliveries()
List deliveries fanned out to configuration set destinations
$fc->sns()
Method
Description
getMessages()
List all published messages
getPendingConfirmations()
List subscriptions pending confirmation
confirmSubscription($req)
Confirm a pending subscription
getSigningCertPem()
Get the PEM body served by the SNS signing-cert endpoint
getSmsMessages()
List SMS messages dispatched via SNS
$fc->sqs()
Method
Description
getMessages()
List all messages across all queues
tickExpiration()
Tick the message expiration processor
forceDlq($queueName, ?$accountId, ?$region)
Force all messages to the queue's DLQ (default account/region: the server's)
$fc->applicationAutoscaling()
Method
Description
tick()
Tick the Application Auto Scaling metric/policy processor
Fail an SSM Run Command with structured error metadata
getParameterPolicyEvents($accountId = null)
List Parameter Store policy expiration/notification events
injectSession($req)
Inject a Session Manager session for inspection in tests
$fc->kms()
Method
Description
getUsage()
Get KMS key usage counters (encrypt/decrypt/sign)
$fc->wafv2()
Method
Description
evaluate($body)
Evaluate a request against a WAFv2 WebACL and return the decision
$fc->cloudfront()
Method
Description
getDistributions()
List CloudFront distributions (id, domain, served)
setDistributionStatus($distributionId, $status)
Force a CloudFront distribution into a status
$fc->serviceQuotas()
Method
Description
getQuotas(?$accountId, ?$region, ?$serviceCode)
List quotas with applied value, usage and enforcement state (default account/region: the server's); without a service code: the enforceable, measured or changed quotas (applied value, override, open request); with one: the whole service
putQuota($serviceCode, $quotaCode, $req)
Set a quota's applied value (may be below the AWS default) and/or enforcement override
Reset a quota to its AWS default and drop its override (the account's when $accountId is given)
getEnforcement()
Read the global enforceAll switch and every per-quota / per-account override
putEnforcement($req)
Change the global switch and/or a batch of overrides (all validated before any is applied)
getRequestApproval()
Read how increase requests are decided (auto or manual)
setRequestApproval($mode)
Switch between auto and manual approval
getRequests(?$accountId, ?$status)
List quota increase requests, newest first
approveRequest($requestId)
Approve a pending request, raising the applied value
denyRequest($requestId, ?$status)
Close a pending request (DENIED by default, or NOT_APPROVED / CASE_CLOSED / INVALID_REQUEST)
Enforcement is tri-state via the QuotaEnforcement enum: Enforce sends true, Ignore sends false, and Default sends null to clear the override. In PutServiceQuotaRequest, leaving enforcement null omits the key entirely and leaves enforcement unchanged.
useFakeCloud\PutServiceQuotaEnforcementRequest;
useFakeCloud\PutServiceQuotaRequest;
useFakeCloud\QuotaEnforcement;
useFakeCloud\ServiceQuotaEnforcementChange;
// Lower "Inbound or outbound rules per security group" to 2 and enforce// it, so the third AuthorizeSecurityGroupIngress rule fails without// creating sixty rules first.$fc->serviceQuotas()->putQuota('vpc', 'L-0EA8095F', newPutServiceQuotaRequest(
value: 2,
enforcement: QuotaEnforcement::Enforce,
));
// Clear that override again, leaving the applied value alone.$fc->serviceQuotas()->putEnforcement(newPutServiceQuotaEnforcementRequest(
overrides: [newServiceQuotaEnforcementChange('vpc', 'L-0EA8095F', QuotaEnforcement::Default)],
));
// Hold increase requests for a manual decision.$fc->serviceQuotas()->setRequestApproval('manual');
foreach ($fc->serviceQuotas()->getRequests(status: 'PENDING')->requestsas$r) {
$fc->serviceQuotas()->approveRequest($r->requestId);
}