PHPackages                             wojt-janowski/laravel-ai-bedrock - 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. [API Development](/categories/api)
4. /
5. wojt-janowski/laravel-ai-bedrock

Abandoned → [clinically/laravel-ai-bedrock](/?search=clinically%2Flaravel-ai-bedrock)ArchivedLibrary[API Development](/categories/api)

wojt-janowski/laravel-ai-bedrock
================================

AWS Bedrock provider for the Laravel AI SDK

v0.3.0(2mo ago)3480MITPHPPHP ^8.4CI failing

Since Feb 21Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/wojt-janowski/laravel-ai-bedrock)[ Packagist](https://packagist.org/packages/wojt-janowski/laravel-ai-bedrock)[ RSS](/packages/wojt-janowski-laravel-ai-bedrock/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (4)Used By (0)

This package has moved
======================

[](#this-package-has-moved)

**This package has been renamed to [`clinically/laravel-ai-bedrock`](https://github.com/clinically-au/laravel-ai-bedrock).**
----------------------------------------------------------------------------------------------------------------------------

[](#this-package-has-been-renamed-to-clinicallylaravel-ai-bedrock)

Update your `composer.json`:

```
composer remove wojt-janowski/laravel-ai-bedrock
composer require clinically/laravel-ai-bedrock
```

Update your namespace imports from `WojtJanowski\LaravelAiBedrock` to `Clinically\LaravelAiBedrock`.

---

Laravel AI Bedrock Provider (archived)
======================================

[](#laravel-ai-bedrock-provider-archived)

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 12+
- `laravel/ai` ^0.3
- `clinically/prism-bedrock`

Installation
------------

[](#installation)

```
composer require clinically/laravel-ai-bedrock
```

The service provider is auto-discovered via Laravel's package discovery.

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

Add these to your `.env`:

```
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_BEDROCK_REGION=us-east-1
```

Optional:

```
AWS_SESSION_TOKEN=your-session-token
AWS_BEDROCK_MAX_TOKENS=16384
AWS_BEDROCK_TEXT_MODEL=anthropic.claude-sonnet-4-5-20250929-v1:0
AWS_BEDROCK_CHEAPEST_MODEL=anthropic.claude-haiku-4-5-20251001-v1:0
AWS_BEDROCK_SMARTEST_MODEL=anthropic.claude-opus-4-6-v1:0
AWS_BEDROCK_EMBEDDINGS_MODEL=amazon.titan-embed-text-v2:0
AWS_BEDROCK_EMBEDDINGS_DIMENSIONS=1024
```

### Provider Registration

[](#provider-registration)

Add the Bedrock provider to your `config/ai.php`:

```
'providers' => [
    'bedrock' => [
        'driver' => 'bedrock',
        'access_key' => env('AWS_ACCESS_KEY_ID'),
        'secret_key' => env('AWS_SECRET_ACCESS_KEY'),
        'session_token' => env('AWS_SESSION_TOKEN'),
        'region' => env('AWS_BEDROCK_REGION', env('AWS_DEFAULT_REGION', 'us-east-1')),
        'max_tokens' => env('AWS_BEDROCK_MAX_TOKENS', 16_384),
        'models' => [
            'text' => [
                'default' => env('AWS_BEDROCK_TEXT_MODEL', 'anthropic.claude-sonnet-4-5-20250929-v1:0'),
                'cheapest' => env('AWS_BEDROCK_CHEAPEST_MODEL', 'anthropic.claude-haiku-4-5-20251001-v1:0'),
                'smartest' => env('AWS_BEDROCK_SMARTEST_MODEL', 'anthropic.claude-opus-4-6-v1:0'),
            ],
            'embeddings' => [
                'default' => env('AWS_BEDROCK_EMBEDDINGS_MODEL', 'amazon.titan-embed-text-v2:0'),
                'dimensions' => env('AWS_BEDROCK_EMBEDDINGS_DIMENSIONS', 1024),
            ],
        ],
    ],
],
```

If no provider config is defined in `config/ai.php`, the package merges sensible defaults automatically.

Usage
-----

[](#usage)

### With Agents (Attribute-based)

[](#with-agents-attribute-based)

```
use Laravel\Ai\Attributes\Agent;

#[Agent(
    model: 'anthropic.claude-sonnet-4-5-20250929-v1:0',
    provider: 'bedrock',
)]
class MyAgent extends \Laravel\Ai\Agent
{
    // ...
}
```

### With Agents (Inline)

[](#with-agents-inline)

```
use Laravel\Ai\Ai;

$provider = Ai::textProvider('bedrock');
```

### Embeddings

[](#embeddings)

```
use Laravel\Ai\Ai;

$provider = Ai::embeddingProvider('bedrock');

$response = $provider->embeddings(['Hello world']);
```

AWS Credential Provider Chain
-----------------------------

[](#aws-credential-provider-chain)

When no explicit `access_key` and `secret_key` are configured, the package automatically uses the AWS default credential provider chain. This supports:

- Environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
- Shared credentials file (`~/.aws/credentials`)
- IAM instance profiles (EC2)
- ECS task roles
- Web identity tokens (EKS)

This is the recommended approach for production deployments on AWS infrastructure.

How It Works
------------

[](#how-it-works)

The Laravel AI SDK's `PrismGateway` uses a hard-coded `match` statement for provider routing that doesn't include Bedrock. This package:

1. Extends `PrismGateway` with `BedrockPrismGateway` to handle the `'bedrock'` driver
2. Registers the Bedrock driver via `Ai::extend()` using this custom gateway
3. Maps AWS credentials to the format expected by `clinically/prism-bedrock`

Credits
-------

[](#credits)

This package was inspired by [PR #134](https://github.com/laravel/ai/pull/134) on `laravel/ai` by **Mohit Kumar** ([@mohitky2018](https://github.com/mohitky2018)), which implemented Bedrock support directly in the SDK. This package extracts that concept into a standalone Composer package.

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance88

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Total

3

Last Release

63d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2ea2e401c2f1f18cafc42d8fb98305ae3575db1fb25455af1c3156d0e79f90e?d=identicon)[wojt-janowski](/maintainers/wojt-janowski)

---

Top Contributors

[![wojt-janowski](https://avatars.githubusercontent.com/u/209190810?v=4)](https://github.com/wojt-janowski "wojt-janowski (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wojt-janowski-laravel-ai-bedrock/health.svg)

```
[![Health](https://phpackages.com/badges/wojt-janowski-laravel-ai-bedrock/health.svg)](https://phpackages.com/packages/wojt-janowski-laravel-ai-bedrock)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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