PHPackages                             synapcores/laravel - 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. [Database &amp; ORM](/categories/database)
4. /
5. synapcores/laravel

ActiveLibrary[Database &amp; ORM](/categories/database)

synapcores/laravel
==================

Laravel integration for the SynapCores AIDB PHP SDK — facade, artisan commands, Eloquent vector cast, RAG trait, and queueable agent jobs

v1.0.0(1mo ago)00MITPHPPHP ^8.1

Since Jun 4Pushed 1mo agoCompare

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

READMEChangelogDependencies (7)Versions (2)Used By (0)

synapcores/laravel — Laravel integration for SynapCores AIDB
============================================================

[](#synapcoreslaravel--laravel-integration-for-synapcores-aidb)

First-class Laravel package on top of [`synapcores/sdk`](../php). Get a `SynapCores` facade, three artisan commands, an Eloquent vector cast, a RAG trait, and a queueable agent job — all wired to a single config file.

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

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12
- A running SynapCores engine (free CE: `docker pull synapcores/community:latest`)

Install
-------

[](#install)

```
composer require synapcores/laravel
php artisan vendor:publish --tag=synapcores-config
```

Then set in `.env`:

```
SYNAPCORES_HOST=localhost
SYNAPCORES_PORT=28080
SYNAPCORES_API_KEY=aidb_…
# or, alternatively:
# SYNAPCORES_USER=admin
# SYNAPCORES_PASSWORD=…
```

That's it — the service provider auto-registers, the facade auto-loads, the singleton client is shared across your whole app.

Facade
------

[](#facade)

```
use SynapCores\Laravel\Facades\SynapCores;

$customers = SynapCores::sql('SELECT * FROM customers WHERE id = :id', ['id' => 42]);
foreach ($customers as $row) {
    echo $row['name'], PHP_EOL;
}

$summary = SynapCores::agentRun(
    persona: 'technical_advisor',
    task:    'Summarize the open support tickets.'
);
echo $summary->answer;
```

Artisan commands
----------------

[](#artisan-commands)

```
# Quick SQL sanity check
php artisan synapcores:query "SELECT NOW()"

# Format options: table (default), json, csv
php artisan synapcores:query "SELECT * FROM customers LIMIT 5" --format=json

# Fire an agent
php artisan synapcores:agent-run --persona=technical_advisor --task="What changed in v1.7?"

# Import a recipe
php artisan synapcores:recipe-import https://synapcores.com/recipes/churn-prediction.md
```

Eloquent vector cast
--------------------

[](#eloquent-vector-cast)

Store embeddings as a `VECTOR(N)` column; work with `float[]` in PHP. The cast handles encoding both ways.

```
use Illuminate\Database\Eloquent\Model;
use SynapCores\Laravel\Eloquent\VectorCast;

class Doc extends Model
{
    protected $casts = [
        'embedding' => VectorCast::class,
    ];
}

// Reads come back as float[]:
$doc = Doc::find(1);
count($doc->embedding); // 384

// Writes accept float[]:
$doc->embedding = SynapCores::embed("hello world");
$doc->save();
```

`HasRAG` trait — semantic search returning Eloquent models
----------------------------------------------------------

[](#hasrag-trait--semantic-search-returning-eloquent-models)

```
use SynapCores\Laravel\Eloquent\HasRAG;

class Doc extends Model
{
    use HasRAG;
    protected $synapcoresEmbeddingColumn = 'embedding'; // optional override
}

// Returns a Collection, each with a _score attribute (cosine similarity).
$hits = Doc::ragSearch('how do I reset my password?', k: 5);
foreach ($hits as $doc) {
    echo "[{$doc->_score}] {$doc->title}\n";
}

// With WHERE filters:
$hits = Doc::ragSearch('billing question', k: 10, where: ['lang' => 'en']);
```

Queue jobs — async agent runs
-----------------------------

[](#queue-jobs--async-agent-runs)

```
use SynapCores\Laravel\Jobs\SynapCoresAgentJob;

$job = new SynapCoresAgentJob(
    persona: 'support_summarizer',
    task: 'Summarize all support tickets opened today.',
    opts: ['max_iterations' => 8]
);
dispatch($job);

// Later, fetch the result:
$result = SynapCoresAgentJob::result($job->jobId);
echo $result['answer'];
```

The job persists its result to the cache under `synapcores:agent:{jobId}` for 1 hour. For custom persistence, pass a `[Class::class, 'method']` tuple as `resultHandler`.

Configuration reference
-----------------------

[](#configuration-reference)

All keys are documented in `config/synapcores.php`. The most-used ones:

`.env`DefaultNotes`SYNAPCORES_HOST``localhost``SYNAPCORES_PORT``28080``SYNAPCORES_USE_HTTPS``false`Set `true` in prod`SYNAPCORES_API_KEY`—`aidb_…` Bearer key (recommended)`SYNAPCORES_USER`—For login() flow`SYNAPCORES_PASSWORD`—For login() flow`SYNAPCORES_DATABASE`—Sets `X-Database` header`SYNAPCORES_TENANT`—Sets `X-Tenant` header`SYNAPCORES_TIMEOUT``30.0`seconds`SYNAPCORES_QUEUE_CONNECTION`defaultQueue connection for the agent jobEngine compatibility
--------------------

[](#engine-compatibility)

Tested live against SynapCores AIDB **v1.7.0.2.1-ce** (current `:latest`, image `ghcr.io/synapcores/community:latest`). Full integration suite passes through the facade + service container against a real engine. See `synapcores-sdks/php/PHP_SDK_PLAN.md` in the SDK monorepo for the validation matrix.

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

50d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/91482309?v=4)[Luis M](/maintainers/mataluis2k)[@mataluis2k](https://github.com/mataluis2k)

---

Top Contributors

[![mataluis2k](https://avatars.githubusercontent.com/u/91482309?v=4)](https://github.com/mataluis2k "mataluis2k (1 commits)")

---

Tags

laraveleloquentragvector-databaseagenticsynapcoresaidbai-database

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-medialibrary

Associate files with Eloquent models

6.2k43.2M656](/packages/spatie-laravel-medialibrary)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M136](/packages/laravel-pulse)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M246](/packages/laravel-ai)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M133](/packages/roots-acorn)[itpathsolutions/dbstan

Database Standardization and Analysis Tool for Laravel

463.0k](/packages/itpathsolutions-dbstan)

PHPackages © 2026

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