PHPackages                             xp-forge/aws - 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. [Framework](/categories/framework)
4. /
5. xp-forge/aws

ActiveLibrary[Framework](/categories/framework)

xp-forge/aws
============

AWS Core for the XP Framework

v3.0.0(1y ago)018.0k1BSD-3-ClausePHPPHP &gt;=7.4.0CI passing

Since Mar 15Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/xp-forge/aws)[ Packagist](https://packagist.org/packages/xp-forge/aws)[ Docs](http://xp-framework.net/)[ RSS](/packages/xp-forge-aws/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (25)Used By (1)

AWS Core for the XP Framework
=============================

[](#aws-core-for-the-xp-framework)

[![Build status on GitHub](https://github.com/xp-forge/aws/workflows/Tests/badge.svg)](https://github.com/xp-forge/aws/actions)[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)[![Latest Stable Version](https://camo.githubusercontent.com/f40b17f013d746fee230be39b8b4439217461991be2daf16b925746c60c890af/68747470733a2f2f706f7365722e707567782e6f72672f78702d666f7267652f6177732f76657273696f6e2e737667)](https://packagist.org/packages/xp-forge/aws)

Provides common AWS functionality in a low-level and therefore lightweight library (*less than 3% of the size of the official PHP SDK!*)

Invoking a lambda
-----------------

[](#invoking-a-lambda)

```
use com\amazon\aws\{Credentials, ServiceEndpoint};
use util\Secret;
use util\cmd\Console;
use util\log\Logging;

$credentials= new Credentials($accessKey, new Secret($secretKey));

$api= (new ServiceEndpoint('lambda', $credentials))->in('eu-central-1')->version('2015-03-31');
$api->setTrace(Logging::all()->toConsole());

$r= $api->resource('/functions/greet/invocations')->transmit(['name' => getenv('USER')]);

Console::writeLine($r);
Console::writeLine($r->value());
```

Credential providers
--------------------

[](#credential-providers)

AWS credentials are stored in various places, depending on the runtime environment. The *CredentialProvider* class supports the following:

- **Environment variables**: Uses `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and (if present) `AWS_SESSION_TOKEN`
- **Shared credentials and config files**: Reads credentials from `~/.aws/config` and (if present) `~/.aws/credentials` (honoring alternative locations set via environment variables)
- **SSO**: Uses configured SSO and the cached credentials created by AWS CLI's [login](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/sso/login.html) command, including SSO session support
- **Amazon ECS container credentials**: Uses the container API to fetch (and refresh, if necessary) the credentials

See

Sharing a S3 resource
---------------------

[](#sharing-a-s3-resource)

The following creates a pre-signed link which is valid for 3 minutes:

```
use com\amazon\aws\{ServiceEndpoint, CredentialProvider};
use util\cmd\Console;

$s3= (new ServiceEndpoint('s3', CredentialProvider::default()))
  ->in('eu-central-1')
  ->using('my-bucket')
;
$link= $s3->sign('/path/to/resource.png', timeout: 180);

Console::writeLine($link);
```

Streaming uploads to S3
-----------------------

[](#streaming-uploads-to-s3)

S3 doesn't double-encode its paths when signing them (see [aws/aws-sdk-php#633](https://github.com/aws/aws-sdk-php/pull/633)), pass `S3Key` instances to support arbitrary filenames:

```
use com\amazon\aws\api\SignatureV4;
use com\amazon\aws\{ServiceEndpoint, CredentialProvider, S3Key};
use io\File;
use util\cmd\Console;

$s3= (new ServiceEndpoint('s3', CredentialProvider::default()))
  ->in('eu-central-1')
  ->using('my-bucket')
;

$file= new File($argv[1]);
$file->open(File::READ);

try {
  $transfer= $s3->resource(new S3Key('target', $file->filename))->open('PUT', [
    'x-amz-content-sha256' => SignatureV4::UNSIGNED, // Or calculate from file
    'Content-Type'         => 'text/plain',
    'Content-Length'       => $file->size(),
  ]);
  while (!$file->eof()) {
    $transfer->write($file->read());
  }
  $response= $transfer->finish();

  Console::writeLine($response);
} finally {
  $file->close();
}
```

Streaming responses from Bedrock AI models
------------------------------------------

[](#streaming-responses-from-bedrock-ai-models)

See [https://docs.aws.amazon.com/bedrock/latest/APIReference/API\_runtime\_ConverseStream.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html):

```
use com\amazon\aws\{ServiceEndpoint, CredentialProvider};
use util\cmd\Console;

$model= 'anthropic.claude-3-5-sonnet-20240620-v1:0';
$runtime= (new ServiceEndpoint('bedrock', CredentialProvider::default()))
  ->using('bedrock-runtime.')
  ->in('eu-central-1')
;

$response= $runtime->resource('/model/{0}/converse-stream', [$model])->transmit([
  'system' => [['text' => 'Use informal language']],
  'messages' => [
    ['role' => 'user', 'content' => [['text' => $argv[1]]]],
  ],
  'inferenceConfig' => [
    'maxTokens'   => 1000,
    'temperature' => 0.5,
  ],
]);
foreach ($response->events() as $event) {
  Console::writeLine($event->header(':event-type'), ': ', $event->value());
}
```

See also
--------

[](#see-also)

- [AWS Lambda for XP Framework](https://github.com/xp-forge/lambda)
- [AWS Lambda Webservices for the XP Framework](https://github.com/xp-forge/lambda-ws)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance63

Regular maintenance activity

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~34 days

Recently: every ~65 days

Total

24

Last Release

379d ago

Major Versions

v0.1.0 → v1.0.02023-03-15

v1.8.1 → v2.0.02024-07-05

v1.8.2 → v2.2.02024-07-13

v2.7.0 → v3.0.02025-05-04

PHP version history (2 changes)v0.1.0PHP &gt;=7.0.0

v3.0.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/07d18d882c8b4aaf3466432f64018214f2771eda333202175431ee7233795376?d=identicon)[thekid](/maintainers/thekid)

---

Top Contributors

[![thekid](https://avatars.githubusercontent.com/u/696742?v=4)](https://github.com/thekid "thekid (154 commits)")

---

Tags

awsaws-bedrockaws-credentialsaws-sdkaws-servicesaws-signature-v4aws-ssophp7php8s3streamingxp-frameworkmodulexp

### Embed Badge

![Health badge](/badges/xp-forge-aws/health.svg)

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

###  Alternatives

[nwidart/laravel-modules

Laravel Module management

6.1k14.6M274](/packages/nwidart-laravel-modules)[xp-framework/compiler

XP Compiler

2026.0k9](/packages/xp-framework-compiler)

PHPackages © 2026

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