For developers
Zero to grounded answers in ten minutes.
One Composer package. Cloud mode needs nothing but an API key; local mode needs Ollama and one SQL-capable model. No vector database, no embeddings, no indexing pipeline.
composer require dbmind/laravel-sql
# health check — run any time ✓ Database connection mysql reachable · read-only ✓ 12 tables approved · auto-configured from schema ✓ Foreign keys mapped · 9 join paths ✓ Gateway cloud:dbmind-sql · API key valid ✓ SqlGuard active · LIMIT enforced · 5s statement timeout ✓ Deny-list active: password, token, secret, api_key All systems go. Ask something: $ php artisan dbmind1:test "top 3 customers by spend" --show-sql
PHP
8.3+
strict types everywhere
Laravel
11 · 12 · 13
installs into your existing app
Database
Any
MySQL · MariaDB · PostgreSQL · SQLite
Ollama
1 model
local mode only — cloud needs none
The walkthrough
Four steps.
Copy, paste, answer.
Each block is copyable. If anything misbehaves, dbmind1:doctor will tell you exactly which link in the chain is down.
-
Step 01
Require the package
Pull DBMind into your existing Laravel app. The service provider auto-registers; nothing touches your database yet.
$composer require dbmind/laravel-sql$php artisan vendor:publish --tag=dbmind1-config↑ publishing the config is optional — the wizard writes it for you
-
Step 02
Choose your provider
Cloud mode needs nothing but the API key from your DBMind dashboard — the gateway writes the SQL, your server guards and runs it. Local mode keeps even the model on your hardware: pull one SQL-capable model.
$ollama pull qwen2.5-coder:7b↑ local mode only — skip this entirely if you'll paste a cloud API key
-
Step 03
Run the install wizard
The wizard asks one approval question — which tables the AI must NOT answer from — then auto-configures everything else straight from your schema.
- Pick provider: DBMind Cloud or local Ollama
- Exclude tables — framework tables pre-selected
- password, token, secret, api_key blocked automatically
- Keys, columns, foreign-key join paths inferred from the schema
$php artisan dbmind1:install┌ Which tables should the AI NOT answer from? │ ◼ migrations ◼ jobs ◼ sessions ◻ orders ◻ products ├ ⨯ 2 sensitive columns auto-blocked └ Auto-configuring 12 tables… keys · columns · joins ✓ -
Step 04
Verify, then ask
The doctor checks every link: database, approved tables, the AI gateway, the guard. Then ask your first question straight from the CLI — --show-sql prints the exact query so every answer is auditable.
$php artisan dbmind1:doctor$php artisan dbmind1:test "top 3 customers by spend" --show-sql↑ first grounded answer. That's the whole install.
In your app
One facade.
Typed responses.
Ask from anywhere in your codebase. Every response carries the answer, the exact SQL it ran, and token usage for metering — and genuinely ambiguous questions can ask back before answering.
answer — phrased only from the rows the query returned
metadata['sql'] — the exact read-only SELECT, auditable
usage — token counts for quota visibility
use DBMind1\Laravel\Facades\DBMind1; use DBMind1\Domain\DTO\AskRequest; $response = DBMind1::ask(new AskRequest( question: 'top 3 customers by spend', allowClarify: false, )); $response->answer; // grounded in the rows that came back $response->metadata['sql']; // the exact SELECT that ran $response->usage; // token counts // genuinely ambiguous questions can ask back: if ($response->isClarification()) { $response->clarifyingQuestions(); // collect answers, re-ask }
Cheat sheet
Every command you'll need.
| dbmind1:install | Interactive setup: provider + table exclusions + auto-config |
| dbmind1:doctor | Health check: DB read access + the AI gateway |
| dbmind1:discover | Read-only listing of connections, tables, columns |
| dbmind1:sync | After migrations: approve new tables, refresh metadata |
| dbmind1:test "…" | Ask from the CLI (--show-sql · --think · --no-clarify) |
Configuration
The .env that matters.
# cloud mode — the gateway writes the SQL, your server runs it DBMIND1_PROVIDER=cloud DBMIND1_API_URL=https://api.dbmind.ai DBMIND1_API_KEY=sk_live_xxx DBMIND1_PROJECT_ID=project_xxx # local mode — everything on your server # DBMIND1_PROVIDER=local # DBMIND1_OLLAMA_URL=http://localhost:11434 # DBMIND1_CHAT_MODEL=qwen2.5-coder:7b # both modes — guarding & execution are always local DBMIND1_SQL_MAX_ROWS=200 DBMIND1_SQL_TIMEOUT_MS=5000
Defence in depth: point DBMIND1_SQL_CONNECTION at a database user with only SELECT grants.
Built something with it?
We want to see.
Star the repo, open an issue, or create a cloud project when you're ready to ship to production.