PHPackages                             mkreftsymfonia/laravel-eloquent-ai - 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. mkreftsymfonia/laravel-eloquent-ai

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

mkreftsymfonia/laravel-eloquent-ai
==================================

Laravel Eloquent AI is a Laravel package that allows asking an AI for database queries.

1.1.0(1y ago)15MITPHPPHP ^8.3

Since Nov 9Pushed 1y agoCompare

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

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

Ask DB allows you to use OpenAI's GPT-3 to build natural language database queries.

```
DB::ask('How many users do we have on the "pro" plan?');
```

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

[](#installation)

You can install the package via composer:

```
composer require mkreftsymfonia/laravel-eloquent-ai
```

You can publish the config file with:

```
php artisan vendor:publish --tag="ask-database-config"
```

This is the contents of the published config file:

```
return [
    /**
     * The database connection name to use. Depending on your
     * use case, you might want to limit the database user
     * to have read-only access to the database.
     */
    'connection' => env('ASK_DATABASE_DB_CONNECTION', 'mysql'),

    /**
     * Strict mode will throw an exception when the query
     * would perform a write/alter operation on the database.
     *
     * If you want to allow write operations - or if you are using a read-only
     * database user - you may disable strict mode.
     */
    'strict_mode' => env('ASK_DATABASE_STRICT_MODE', true),

    /**
     * The maximum number of tables to use before performing an additional
     * table name lookup call to OpenAI.
     * If you have a lot of database tables and columns, they might not fit
     * into a single request to OpenAI. In that case, we will perform a
     * lookup call to OpenAI to get the matching table names for the
     * provided question.
     */
    'max_tables_before_performing_lookup' => env('ASK_DATABASE_MAXIMUM_TABLES', 15),
];
```

Usage
-----

[](#usage)

First, you need to configure your OpenAI API key in your `.env` file:

```
OPENAI_API_KEY=sk-...
```

Then, you can use the `DB::ask()` method to ask the database:

```
$response = DB::ask('How many users are there?');
```

Testing
-------

[](#testing)

```
composer test
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.1% 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 ~0 days

Total

2

Last Release

549d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c54051a4dec3e578ac6999ce9f7dc37ad5672039417b1bc86286d2add8e86dd?d=identicon)[mkreftsymfonia](/maintainers/mkreftsymfonia)

---

Top Contributors

[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (25 commits)")[![mkreftsymfonia](https://avatars.githubusercontent.com/u/170101202?v=4)](https://github.com/mkreftsymfonia "mkreftsymfonia (5 commits)")[![hafezdivandari](https://avatars.githubusercontent.com/u/56585913?v=4)](https://github.com/hafezdivandari "hafezdivandari (1 commits)")[![tomlloyd](https://avatars.githubusercontent.com/u/51801753?v=4)](https://github.com/tomlloyd "tomlloyd (1 commits)")

---

Tags

laravelailaravel-ask-databasemkreftsymfoniaai-query-generator

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mkreftsymfonia-laravel-eloquent-ai/health.svg)

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

###  Alternatives

[maestroerror/laragent

Power of AI Agents in your Laravel project

630106.4k](/packages/maestroerror-laragent)[helgesverre/extractor

AI-Powered Data Extraction for your Laravel application.

22128.0k](/packages/helgesverre-extractor)[laracraft-tech/laravel-useful-additions

A collection of useful Laravel additions!

58109.4k](/packages/laracraft-tech-laravel-useful-additions)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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