PHPackages                             mbs047/model-mind - 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. mbs047/model-mind

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

mbs047/model-mind
=================

ModelMind: a secure, configurable, model-aware AI chat assistant for Laravel applications.

v1.0.15(2w ago)1047↓100%1MITPHPPHP ^8.3CI passing

Since May 20Pushed 2w agoCompare

[ Source](https://github.com/mbs047/model-mind)[ Packagist](https://packagist.org/packages/mbs047/model-mind)[ GitHub Sponsors](https://github.com/mbs047)[ RSS](/packages/mbs047-model-mind/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (11)Versions (19)Used By (0)

 [![ModelMind - AI assistant for your Laravel application](art/model-mind-banner.png)](art/model-mind-banner.png)

ModelMind
=========

[](#modelmind)

[![CI](https://github.com/mbs047/model-mind/actions/workflows/ci.yml/badge.svg)](https://github.com/mbs047/model-mind/actions/workflows/ci.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/c7d0ab71513d3ec19ab8e4ceff9f300de77789d0b66aa8ba509cf8f0dbf3c783/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d62733034372f6d6f64656c2d6d696e642e737667)](https://packagist.org/packages/mbs047/model-mind)[![License](https://camo.githubusercontent.com/60d34d94e4ed5612a2b3ced23b71c250fe07a47be325d8f6c269a61c226ccaec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d62733034372f6d6f64656c2d6d696e642e737667)](LICENSE.md)

ModelMind is a secure, configurable, model-aware AI chat assistant for Laravel applications.

It gives any Laravel app a reusable Blade/Tailwind chat modal, persisted conversation history, configurable Eloquent model context, safe column auto-discovery, learning memory, feedback, and an OpenAI provider behind a clean package interface.

Demo Store
----------

[](#demo-store)

Try ModelMind in [Market Lane Store](https://mbs-sample.on-forge.com/), a sample store and showcase application for MBS packages with ModelMind installed for testing.

Features
--------

[](#features)

- Drop-in Blade chat modal with Tailwind-friendly styles.
- Headless JSON API mode for React, Vue, Inertia, and mobile clients.
- Optional streaming responses for faster-feeling chat UIs.
- `@modelMind`, `@modelMindModal`, `@modelMindStyles`, and `@modelMindScripts` directives.
- Built-in presets for store, admin, support, docs, and CRM applications.
- Configurable widget position, width, offset, z-index, labels, prompt tone, and brand mark.
- Model-aware answers from only the Eloquent models you explicitly enable.
- User-aware context with guard, role, tenant, and Gate/policy scoping.
- Ranked retrieval with weighted columns, fuzzy matching, multilingual normalization, optional Scout, and optional vector search.
- Auto-discovered columns with sensitive field filtering.
- Per-model control through the `HasModelMindContext` trait.
- Persisted chat sessions, message history, user feedback, and learned knowledge.
- Current-page awareness so visitors can ask about the product, record, or content they are viewing.
- Usage analytics and Laravel events for latency, token usage, provider/model usage, failures, feedback rate, action clicks, generated answers, and learned memory.
- Configurable table prefix for clean package ownership.
- Safe named-route action buttons from configured Laravel routes.
- Source citations that show the model, record, fields used, and optional record button.
- Multilingual chat: visitors can ask and receive answers in their language, even when your stored application data is in one database language.
- Provider drivers for OpenAI, Anthropic, Gemini, Ollama, and custom AI gateways.

Quick Start
-----------

[](#quick-start)

Install the package:

```
composer require mbs047/model-mind
```

Publish the package assets and run migrations:

```
php artisan model-mind:install
php artisan migrate
```

Add your OpenAI credentials:

```
OPENAI_API_KEY=sk-your-key
OPENAI_ORGANIZATION=org-your-organization-id
MODEL_MIND_PROVIDER=openai
MODEL_MIND_MODEL=gpt-5-nano
```

Render ModelMind in your Blade layout:

```
@modelMindStyles
@modelMindModal
@modelMindScripts
```

Or use the one-line directive:

```
@modelMind
```

Enable the models the assistant is allowed to know about in `config/model-mind.php`:

```
'models' => [
    App\Models\Product::class => [
        'enabled' => true,
        'label' => 'Products',
        'description' => 'Public product catalog.',
        'columns' => 'auto',
        'include' => ['name', 'slug', 'summary', 'price'],
        'exclude' => ['internal_notes'],
        'relations' => ['category:id,name'],
        'limit' => 50,
        'order_by' => ['updated_at' => 'desc'],
    ],
],
```

Inspect the exact context before using it in production:

```
php artisan model-mind:inspect-context
```

That is the whole first path: install, configure credentials, render the widget, enable safe model context, inspect it, and ask questions from your app.

Common Options
--------------

[](#common-options)

```
MODEL_MIND_BRAND_MARK=MBS
MODEL_MIND_PRESET=store
MODEL_MIND_THEME=auto
MODEL_MIND_POSITION=bottom-right
MODEL_MIND_WIDTH=25rem
MODEL_MIND_OFFSET=1.25rem
MODEL_MIND_Z_INDEX=9999
MODEL_MIND_TABLE_PREFIX=model_mind_
MODEL_MIND_PROVIDER=openai
MODEL_MIND_API_ENABLED=true
MODEL_MIND_API_PREFIX=api/model-mind
MODEL_MIND_DEFAULT_QUESTIONS="What can you help with?|What data can you see?|How do I configure you?"
MODEL_MIND_SESSION_LIFETIME_MINUTES=120
MODEL_MIND_STREAMING=false
MODEL_MIND_BACKGROUND_MODE=after_response
MODEL_MIND_BACKGROUND_QUEUE=model-mind
MODEL_MIND_CONTEXT_CACHE_SECONDS=600
MODEL_MIND_RETRIEVAL_ENABLED=true
MODEL_MIND_RETRIEVAL_FUZZY=true
MODEL_MIND_RETRIEVAL_MULTILINGUAL=true
MODEL_MIND_INFER_ROUTE_ACTIONS=true
MODEL_MIND_CITATIONS_ENABLED=true
MODEL_MIND_INFER_SOURCE_CITATIONS=true
MODEL_MIND_PAGE_CONTEXT_ENABLED=true
MODEL_MIND_ANALYTICS_ENABLED=true
MODEL_MIND_MAX_OUTPUT_TOKENS=450
MODEL_MIND_STYLES_ASSET=vendor/model-mind/model-mind.css
MODEL_MIND_SCRIPTS_ASSET=vendor/model-mind/model-mind.js
```

Supported widget positions are `bottom-right`, `bottom-left`, `bottom-center`, `top-right`, `top-left`, `top-center`, `center`, `center-left`, and `center-right`. Short aliases are accepted for `top`, `bottom`, `left`, and `right`.

Full Documentation
------------------

[](#full-documentation)

Read the documentation index in [docs/README.md](docs/README.md). Start with [docs/examples.md](docs/examples.md) for simple and advanced copyable setups. Each major feature has its own focused guide: installation, Blade rendering, themes, public assets, headless API mode, streaming responses, provider drivers, model configuration, multilingual answers, retrieval, route actions, source citations, authorization, security, learning memory, feedback, current page context, analytics, events and hooks, background queues, table prefixes, routes, performance, and testing.

For starter configuration by application type, run:

```
php artisan model-mind:preset --list
php artisan model-mind:preset store --json
```

For custom UI work, read [docs/customizing-the-modal.md](docs/customizing-the-modal.md). You can publish the default modal view, or point ModelMind to a new modal plus custom public CSS and JavaScript assets.

For application links, configure named route actions in `config/model-mind.php`; ModelMind will only turn approved route tokens into buttons.

Security
--------

[](#security)

ModelMind is explicit by design. It does not expose every model automatically, filters common sensitive columns, respects model `$hidden` and `$visible`, strips HTML from context values by default, and treats database content as data rather than instructions.

Review [SECURITY.md](SECURITY.md) before reporting vulnerabilities or enabling sensitive production data.

Contributing
------------

[](#contributing)

Pull requests are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md), run the test suite, and keep the package behavior secure by default.

```
composer install
composer test
composer format
```

License
-------

[](#license)

ModelMind is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance96

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Total

16

Last Release

20d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/540d5e198a3e5937f814e36b23345ed9aadb6e53fd5cb138f2c73cac11b4c252?d=identicon)[mbs047](/maintainers/mbs047)

---

Top Contributors

[![mbs047](https://avatars.githubusercontent.com/u/38505129?v=4)](https://github.com/mbs047 "mbs047 (34 commits)")

---

Tags

laravelaieloquentbladetailwindchatassistantmbs

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mbs047-model-mind/health.svg)

```
[![Health](https://phpackages.com/badges/mbs047-model-mind/health.svg)](https://phpackages.com/packages/mbs047-model-mind)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

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

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

1.7k14.1M120](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9732.3M121](/packages/roots-acorn)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k53.0M578](/packages/laravel-scout)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

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