PHPackages                             fakecloud/fakecloud - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. fakecloud/fakecloud

ActiveLibrary[Testing &amp; Quality](/categories/testing)

fakecloud/fakecloud
===================

PHP client SDK for fakecloud — a local AWS cloud emulator

v0.16.0(1w ago)00AGPL-3.0-or-laterPHPPHP &gt;=8.1

Since Apr 18Pushed 1w agoCompare

[ Source](https://github.com/faiscadev/fakecloud-php)[ Packagist](https://packagist.org/packages/fakecloud/fakecloud)[ Docs](https://github.com/faiscadev/fakecloud)[ RSS](/packages/fakecloud-fakecloud/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (16)Used By (0)

fakecloud
=========

[](#fakecloud)

PHP client SDK for [fakecloud](https://github.com/faiscadev/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
------------

[](#installation)

```
composer require fakecloud/fakecloud
```

Quick start
-----------

[](#quick-start)

```
use FakeCloud\FakeCloud;

$fc = new FakeCloud('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
-------------

[](#api-reference)

### `FakeCloud`

[](#fakecloud-1)

```
$fc = new FakeCloud();                        // defaults to http://localhost:4566
$fc = new FakeCloud('http://localhost:4566'); // explicit base URL
```

MethodDescription`baseUrl()`Return the configured base URL`health()`Server health check`reset()`Reset all service state`resetService($service)`Reset a single service`createAdmin($accountId, $userName)`Bootstrap an admin IAM user in an additional account### `$fc->lambda()`

[](#fc-lambda)

MethodDescription`getInvocations()`List recorded Lambda invocations`getWarmContainers()`List warm (cached) Lambda containers`evictContainer($functionName)`Evict a warm container`downloadFunctionCode($accountId, $functionName, $qualifier)`Download a function's stored zip bundle (raw bytes)`downloadLayerContent($accountId, $layerName, $version)`Download a layer version's stored zip (raw bytes)### `$fc->rds()`

[](#fc-rds)

MethodDescription`getInstances()`List RDS instances with runtime metadata`lambdaInvoke($req)`Bridge endpoint for the PostgreSQL `aws_lambda` extension`s3Import($req)`Bridge endpoint for the PostgreSQL `aws_s3` extension (S3 -&gt; DB)`s3Export($req)`Bridge endpoint for the PostgreSQL `aws_s3` extension (DB -&gt; S3 PutObject)### `$fc->elasticache()`

[](#fc-elasticache)

MethodDescription`getClusters()`List ElastiCache cache clusters`getReplicationGroups()`List ElastiCache replication groups`getServerlessCaches()`List ElastiCache serverless caches`getElastiCacheAcls()`List ElastiCache user ACLs### `$fc->ecr()`

[](#fc-ecr)

MethodDescription`getRepositories()`List ECR repositories`getImages($repositoryName = null)`List ECR images (optionally per repo)`getPullThroughRules()`List ECR pull-through cache rules### `$fc->logs()`

[](#fc-logs)

MethodDescription`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()`

[](#fc-ses)

MethodDescription`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()`

[](#fc-sns)

MethodDescription`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()`

[](#fc-sqs)

MethodDescription`getMessages()`List all messages across all queues`tickExpiration()`Tick the message expiration processor`forceDlq($queueName)`Force all messages to the queue's DLQ### `$fc->applicationAutoscaling()`

[](#fc-applicationautoscaling)

MethodDescription`tick()`Tick the Application Auto Scaling metric/policy processor`scheduledTick()`Tick the scheduled-action processor### `$fc->athena()`

[](#fc-athena)

MethodDescription`getNamedQueries()`List all stored Athena named queries### `$fc->events()`

[](#fc-events)

MethodDescription`getHistory()`Get event history and delivery records`fireRule($req)`Fire an EventBridge rule manually### `$fc->scheduler()`

[](#fc-scheduler)

MethodDescription`getSchedules()`List EventBridge Scheduler schedules`fireSchedule($group, $name)`Fire a scheduled invocation immediately### `$fc->glue()`

[](#fc-glue)

MethodDescription`getJobs()`List all Glue jobs`getJobRuns($jobName = null)`List Glue job runs (optionally per job)`getCrawlers()`List Glue crawlers with state and targets### `$fc->cloudwatch()`

[](#fc-cloudwatch)

MethodDescription`getAlarms()`List metric and composite alarms`getMetrics()`List unique metric series with latest value### `$fc->firehose()`

[](#fc-firehose)

MethodDescription`getDeliveryStreams()`List delivery streams with type, status, encryption, dest count### `$fc->s3()`

[](#fc-s3)

MethodDescription`getNotifications()`List S3 notification events`tickLifecycle()`Tick the lifecycle processor`getAccessPoints()`List S3 access points`getObjectLambdaResponses()`List recorded S3 Object Lambda WriteGetObjectResponse calls### `$fc->dynamodb()`

[](#fc-dynamodb)

MethodDescription`tickTtl()`Tick the TTL processor### `$fc->secretsmanager()`

[](#fc-secretsmanager)

MethodDescription`tickRotation()`Tick the rotation scheduler### `$fc->cognito()`

[](#fc-cognito)

MethodDescription`getUserCodes($poolId, $username)`Get confirmation codes for a user`getConfirmationCodes()`List all confirmation codes`confirmUser($req)`Confirm a user (bypass verification)`getTokens()`List all active tokens`expireTokens($req)`Expire tokens (optionally filtered)`getAuthEvents()`List auth events`getPreTokenGenInvocations()`List PreTokenGeneration Lambda trigger invocations`mintAuthorizationCode($req)`Mint a single-use OAuth2 authorization code (alternative to /oauth2/authorize)`setCompromisedPasswords($req)`Mark passwords as compromised for the advanced-security simulator`getWebAuthnCredentials()`List enrolled WebAuthn credentials### `$fc->apigatewayv2()`

[](#fc-apigatewayv2)

MethodDescription`getRequests()`List all HTTP API requests received`getConnections()`List active WebSocket API connections`mtlsInfo($domainName)`Get mTLS truststore info for a custom domain`wsUrl($apiId, $stage = null)`Compute the WebSocket URL for an API/stage### `$fc->stepfunctions()`

[](#fc-stepfunctions)

MethodDescription`getExecutions()`List all state machine execution history`getSyncExecutions()`List `StartSyncExecution` results`getExecutionTree($arn)`Get the full parent/child execution tree for an execution`enqueueActivityTask($req)`Enqueue an activity task for `GetActivityTask` consumers### `$fc->bedrock()`

[](#fc-bedrock)

MethodDescription`getInvocations()`List recorded Bedrock runtime invocations`setModelResponse($modelId, $text)`Configure a single canned response for a model`setResponseRules($modelId, $rules)`Replace prompt-conditional response rules for a model`clearResponseRules($modelId)`Clear all prompt-conditional response rules for a model`queueFault($rule)`Queue a fault rule for the next N calls`getFaults()`List currently queued fault rules`clearFaults()`Clear all queued fault rules### `$fc->bedrockAgent()`

[](#fc-bedrockagent)

MethodDescription`getAgents()`List Bedrock Agent definitions### `$fc->bedrockAgentRuntime()`

[](#fc-bedrockagentruntime)

MethodDescription`getInvocations()`List Bedrock Agent runtime invocations### `$fc->ecs()`

[](#fc-ecs)

MethodDescription`getClusters()`List ECS clusters`getTasks($cluster = null, $status = null)`List ECS tasks (optionally filtered by cluster and status)`getTask($taskId)`Get a single ECS task`getTaskLogs($taskId)`Get captured stdout/stderr logs for a task`forceStopTask($taskId)`Force-stop a running task`markTaskFailed($taskId, $req)`Mark a task as failed with the supplied reason`getEvents()`List ECS service/task lifecycle events`getTaskMetadata($taskArn)`Get ECS task metadata (control-plane shape)`getTaskCredentials($taskId)`Get the IAM credentials served via the task metadata endpoint`getTaskMetadataV3($taskId)`Get the task metadata v3 payload`getTaskMetadataV4($taskId)`Get the task metadata v4 payload### `$fc->elbv2()`

[](#fc-elbv2)

MethodDescription`getLoadBalancers()`List ELBv2 load balancers`getTargetGroups()`List ELBv2 target groups`getListeners()`List ELBv2 listeners`getRules()`List ELBv2 listener rules`flushAccessLogs()`Flush buffered ELBv2 access logs to their S3 bucket`getWafCounts()`Get WAF allow/block counts seen by ELBv2 listeners### `$fc->route53()`

[](#fc-route53)

MethodDescription`setHealthCheckStatus($id, $status, $reason)`Flip a health check between `Success` / `Failure` / `Timeout` / `DnsError` / `InsufficientDataPoints` / `Unknown` to drive failover routing`getDnssecMaterial($zoneId)`Get the simulated DNSSEC key material for a hosted zone`signDnssec($zoneId, $req)`Sign a payload with the zone's DNSSEC key### `$fc->acm()`

[](#fc-acm)

MethodDescription`setCertificateStatus($arnOrId, $status, $reason)`Force an ACM certificate into a specific status`approveCertificate($arnOrId)`Approve a pending ACM certificate request`getCertificateChainInfo($arnOrId)`Get parsed chain info for an ACM certificate### `$fc->organizations()`

[](#fc-organizations)

MethodDescription`getAccounts()`List Organizations member accounts`getResponsibilityTransfers()`List billing responsibility transfers (direction, status, handshake)### `$fc->ssm()`

[](#fc-ssm)

MethodDescription`setCommandStatus($commandId, $status, $accountId = null)`Force an SSM Run Command into a specific terminal status`failCommand($commandId, $accountId = null, $errorCode = null, ...)`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()`

[](#fc-kms)

MethodDescription`getUsage()`Get KMS key usage counters (encrypt/decrypt/sign)### `$fc->wafv2()`

[](#fc-wafv2)

MethodDescription`evaluate($body)`Evaluate a request against a WAFv2 WebACL and return the decision### `$fc->cloudfront()`

[](#fc-cloudfront)

MethodDescription`setDistributionStatus($distributionId, $status)`Force a CloudFront distribution into a status#### Full test loop — asserting on Bedrock calls

[](#full-test-loop--asserting-on-bedrock-calls)

```
use FakeCloud\FakeCloud;
use FakeCloud\BedrockFaultRule;
use FakeCloud\BedrockResponseRule;

$fc = new FakeCloud();
$modelId = 'anthropic.claude-3-haiku-20240307-v1:0';

// beforeEach
$fc->reset();

// Prime prompt-conditional responses
$fc->bedrock()->setResponseRules($modelId, [
    new BedrockResponseRule('buy now', '{"label":"spam"}'),
    new BedrockResponseRule(null, '{"label":"ham"}'), // catch-all
]);

classify('hello friend');           // user code calls Bedrock
classify('buy now cheap pills');

$invocations = $fc->bedrock()->getInvocations()->invocations;
assert(count($invocations) === 2);
assert(str_contains($invocations[0]->output, 'ham'));
assert(str_contains($invocations[1]->output, 'spam'));
```

### Error handling

[](#error-handling)

All methods throw `FakeCloudError` (a `RuntimeException`) on non-2xx responses:

```
use FakeCloud\FakeCloudError;
use FakeCloud\ConfirmUserRequest;

try {
    $fc->cognito()->confirmUser(new ConfirmUserRequest('pool-1', 'nobody'));
} catch (FakeCloudError $err) {
    echo $err->status; // 404
    echo $err->body;   // "user not found"
}
```

Local development
-----------------

[](#local-development)

```
# Build fakecloud (from repo root)
cargo build --release

# Install PHP dependencies
cd sdks/php
composer install

# Run unit tests
vendor/bin/phpunit tests/ClientTest.php

# Run E2E tests against the freshly-built binary
vendor/bin/phpunit tests/E2ETest.php
```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance98

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

15

Last Release

11d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/19c881e959cfc5806e587720721666c58d1db23592e18cf5b85fd3b6a250c878?d=identicon)[vieiralucas4@gmail.com](/maintainers/vieiralucas4@gmail.com)

---

Tags

testingawsmockemulatorfakecloudlocalstack

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fakecloud-fakecloud/health.svg)

```
[![Health](https://phpackages.com/badges/fakecloud-fakecloud/health.svg)](https://phpackages.com/packages/fakecloud-fakecloud)
```

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k516.1M26.0k](/packages/mockery-mockery)[php-mock/php-mock

PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.

36919.3M118](/packages/php-mock-php-mock)[phake/phake

The Phake mock testing library

4758.2M341](/packages/phake-phake)[kahlan/kahlan

The PHP Test Framework for Freedom, Truth and Justice.

1.1k1.2M252](/packages/kahlan-kahlan)[brain/monkey

Mocking utility for PHP functions and WordPress plugin API

33913.7M436](/packages/brain-monkey)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.7M508](/packages/php-mock-php-mock-phpunit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
