PHPackages                             x-laravel/embedding-oracle-driver - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. x-laravel/embedding-oracle-driver

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

x-laravel/embedding-oracle-driver
=================================

Oracle 26ai vector similarity driver for x-laravel/embedding.

v1.1.2(2w ago)06↓100%MITPHPPHP ^8.3CI passing

Since May 9Pushed 2w agoCompare

[ Source](https://github.com/x-laravel/embedding-oracle-driver)[ Packagist](https://packagist.org/packages/x-laravel/embedding-oracle-driver)[ RSS](/packages/x-laravel-embedding-oracle-driver/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (5)Versions (5)Used By (0)

x-laravel/embedding — Oracle 26ai Driver
========================================

[](#x-laravelembedding--oracle-26ai-driver)

[![Tests](https://github.com/x-laravel/embedding-oracle-driver/actions/workflows/tests.yml/badge.svg)](https://github.com/x-laravel/embedding-oracle-driver/actions/workflows/tests.yml)[![PHP](https://camo.githubusercontent.com/c8d8dad6beb757a2b8acba331d16140813699543b88a37af0a81f20bd35f61de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c7565)](https://www.php.net)[![Laravel](https://camo.githubusercontent.com/42e62a9adb05b6cb16993782fd4b04b64a76be3ff5704d170001885eb70c8448/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313225323025374325323031332d726564)](https://laravel.com)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE.md)

Oracle 26ai native vector similarity driver for [x-laravel/embedding](https://github.com/x-laravel/embedding).

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

[](#how-it-works)

- Implements `SimilarityDriver` — registers as the `oracle` driver, similarity search runs entirely in Oracle using `VECTOR_DISTANCE`
- Implements `VectorStore` — writes embeddings via `MERGE INTO ... USING DUAL` with `TO_VECTOR()`, no PHP-side JSON workaround needed

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

[](#requirements)

- PHP ^8.3
- Laravel ^12.0 | ^13.0
- `x-laravel/embedding ^1.0`
- Oracle Database 26ai (Free or Enterprise)

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

[](#installation)

```
composer require x-laravel/embedding-oracle-driver
```

The `OracleEmbeddingServiceProvider` is auto-discovered and registers the `oracle` driver automatically.

Setup
-----

[](#setup)

### 1. Configure x-laravel/embedding

[](#1-configure-x-laravelembedding)

Publish the config if you haven't already:

```
php artisan vendor:publish --tag=embedding-config
```

Set the similarity driver and database connection in `config/embedding.php`:

```
'database' => [
    'connection' => env('EMBEDDINGS_DATABASE_CONNECTION', 'oracle'),
    'table'      => env('EMBEDDINGS_DB_TABLE', 'embeddings'),
],

'similarity' => [
    'driver' => env('EMBEDDING_SIMILARITY_DRIVER', 'oracle'),
],
```

### 2. Create the embeddings table

[](#2-create-the-embeddings-table)

This driver ships its own Oracle-native migration that **replaces** the default one from `x-laravel/embedding`. It creates a `VECTOR(1536, FLOAT32)` column.

Run the migration:

```
php artisan migrate
```

If you need to customise the DDL (e.g. tablespace, index parameters), publish the migration first:

```
php artisan vendor:publish --tag=embedding-oracle-migrations
php artisan migrate
```

> **Note:** `VECTOR_DISTANCE` works without an index (sequential scan). If you have the Oracle In-Memory option, add a `CREATE VECTOR INDEX ... ORGANIZATION INMEMORY NEIGHBOR GRAPH` statement after publishing the migration.

### 3. Model

[](#3-model)

Follow the standard `x-laravel/embedding` setup. No Oracle-specific changes are needed on your models.

```
use XLaravel\Embedding\Attributes\EmbedOn;
use XLaravel\Embedding\Concerns\Embeddable;
use XLaravel\Embedding\Contracts\HasEmbeddings;

#[EmbedOn('title', 'body')]
class Post extends Model implements HasEmbeddings
{
    use Embeddable;

    public function toEmbeddingText(): string
    {
        return $this->title.' '.$this->body;
    }
}
```

Usage
-----

[](#usage)

The driver is transparent — use the standard `x-laravel/embedding` API:

```
Post::similarToText('web framework', limit: 10);
Post::similarTo($vector, limit: 10, threshold: 0.8);
Post::rankByRelevance($posts, 'web framework');

$post->mostSimilar(limit: 5);
$post->similarityTo($otherPost);
```

All methods set a `similarity_score` float attribute on each returned model.

Testing
-------

[](#testing)

```
# Build first (once per PHP version)
DOCKER_BUILDKIT=0 docker compose --profile php83 build

# Run tests
docker compose --profile php83 up
docker compose --profile php84 up
docker compose --profile php85 up
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/license/MIT).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance96

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Total

4

Last Release

20d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bdb64c6c087c331b8bd5906bb1aa7eb06bc83af3654a48ba8ab9da365976651?d=identicon)[X-Adam](/maintainers/X-Adam)

---

Top Contributors

[![x-adam](https://avatars.githubusercontent.com/u/60411758?v=4)](https://github.com/x-adam "x-adam (5 commits)")

---

Tags

laravelaioraclevectorembedding

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/x-laravel-embedding-oracle-driver/health.svg)

```
[![Health](https://phpackages.com/badges/x-laravel-embedding-oracle-driver/health.svg)](https://phpackages.com/packages/x-laravel-embedding-oracle-driver)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)

PHPackages © 2026

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