PHPackages                             laravel-cortex/cortex - 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. [Framework](/categories/framework)
4. /
5. laravel-cortex/cortex

ActiveLibrary[Framework](/categories/framework)

laravel-cortex/cortex
=====================

Zero-Config Enterprise Agent for Laravel

00PHP

Since Dec 20Pushed 6mo agoCompare

[ Source](https://github.com/AbrarAli14/Laravel-Cortex)[ Packagist](https://packagist.org/packages/laravel-cortex/cortex)[ RSS](/packages/laravel-cortex-cortex/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

🧠 Laravel Cortex
================

[](#-laravel-cortex)

[![Laravel Cortex Logo](art/logo.png)](art/logo.png)

> **The missing brain for your Laravel application.**
> Give your users a powerful "Cmd+K" interface to navigate, search, and execute complex actions using natural language.

[![Latest Version](https://camo.githubusercontent.com/34e695c6016bc2a934a96bed696e29b2f2ab562a7134d65a55d00653cd506bea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e737667)](https://github.com/AbrarAli14/Laravel-Cortex)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE.md)[![Livewire](https://camo.githubusercontent.com/278c85ac4800cf8d368b1802c5c195855416aa016e361b7416600c4c835f5407/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461636b2d4c697665776972652d70696e6b2e737667)](#)[![Blade](https://camo.githubusercontent.com/471953d1efd19a1eeb1f6d921abe8b84090996baf693b8e6f1b41f4aa054bca1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461636b2d426c6164652d6f72616e67652e737667)](#)[![React](https://camo.githubusercontent.com/8ad8d1b016bf4041af455b1d398a9c2853e69f68fbf90ff2e40b84c875ca94e4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461636b2d52656163742d6379616e2e737667)](#)

[![Cortex Demo](art/screenshot.png)](art/screenshot.png)

---

✨ Features at a Glance
----------------------

[](#-features-at-a-glance)

FeatureDescription**🔍 Global Smart Search**Instantly find any Route, Model, or Resource in your app.**🤖 AI Natural Language**Type *"Delete inactive users"* or *"Show high value orders"* and let AI handle it.**🏢 Multi-Tenant Switcher**Switch organizations instantly without complex UI. Built-in session handling.**⚡ Stack Agnostic**Drop-in support for **Livewire**, **Vanilla JS (Blade)**, and **Headless (Next.js)**.**🛡️ Permission Aware**Automatically hides actions user isn't authorized for (`can`, `auth` middleware).**⚙️ Developer Mode**Toggle between `client` (friendly) and `developer` (debug/system) modes.---

🚀 Installation
--------------

[](#-installation)

### 1. Require the Package

[](#1-require-the-package)

```
composer require laravel-cortex/cortex
```

### 2. Run the Installer

[](#2-run-the-installer)

This interactive command helps you choose your stack and publishes necessary assets.

```
php artisan cortex:install
```

### 3. Add to Layout

[](#3-add-to-layout)

Depending on your stack, add the standard component or script.

#### 🟢 Livewire (TALL Stack)

[](#-livewire-tall-stack)

Add this to your main layout (e.g., `layouts/app.blade.php`) before the closing `` tag:

```

```

#### � Blade (Vanilla JS)

[](#-blade-vanilla-js)

For traditional Laravel apps without Livewire:

```

```

#### 🔵 API (Next.js / React / Vue)

[](#-api-nextjs--react--vue)

Cortex exposes a REST API for headless apps.

- `GET /api/cortex/search?query=...`
- `POST /api/cortex/execute`

---

🎮 Usage
-------

[](#-usage)

Press **`Cmd+K`** (Mac) or **`Ctrl+K`** (Windows) to open the palette.

### 1. Navigation &amp; Search

[](#1-navigation--search)

Just start typing. Cortex indexes all your named routes automatically via the `cortex:index` command.

- Type **"Users"** → Finds `UserController@index`.
- Type **"Settings"** → Finds `ProfileController@edit`.

### 2. AI Commands (The Magic 🪄)

[](#2-ai-commands-the-magic-)

If enabled, Cortex sends sentence-length queries (&gt; 3 words) to OpenAI/Gemini.

- *"Delete students named John"*
- *"Create a new product called 'Super Widget'"*
- *"Switch to Acme Corp"*

**How it works:**

1. **Intent Recognition**: AI determines if you want to *View*, *Create*, or *Delete*.
2. **Safety Check**: For destructive actions, Cortex calculates the impact (e.g., "5 records found") and asks for confirmation.
3. **Execution**: Runs the action securely.

### 3. Multi-Tenant Switching

[](#3-multi-tenant-switching)

Cortex can search your Tenant model (e.g., `Organization`).

1. Type the name of the tenant (e.g., "Google").
2. Press Enter to switch context.
3. The Session key `current_tenant_id` is updated automatically.

---

⚙️ Configuration &amp; Environment
----------------------------------

[](#️-configuration--environment)

Control Cortex behavior via your `.env` file.

VariableDefaultDescription**`CORTEX_AI_ENABLED`**`true`Enable/Disable Natural Language interaction.**`CORTEX_AI_DRIVER`**`openai`AI Provider (`openai`, `gemini`).**`OPENAI_API_KEY`**`null`Your LLM API Key.**`CORTEX_TENANTS_ENABLED`**`false`Enable the Organization switcher.**`CORTEX_TENANT_MODEL`**`App\Models\Organization`The model class for your tenants.**`CORTEX_MODE`**`client`**Crucial Setting** (See below).**`CORTEX_STACK`**`livewire`Controls which assets invoke the runner (`livewire`, `blade`, `api`).### 🛠️ Developer vs Client Mode (`CORTEX_MODE`)

[](#️-developer-vs-client-mode-cortex_mode)

- **`client` (Default)**:
    - Hides technical system routes.
    - Shows user-friendly descriptions ("View Profile" instead of `profile.edit`).
    - Hides "Dangerous" system commands (Clear Cache, etc).
- **`developer`**:
    - Shows exact Route URIs (`/users/{id}/edit`).
    - Enables **System Actions** like `optimize:clear`, `route:list`.
    - Great for admins and developers debugging the app.

---

🛡️ Security &amp; Permissions
-----------------------------

[](#️-security--permissions)

Cortex is secure by default. It respects your application's existing authorization gates.

1. **Middleware Check**: Routes with `middleware('can:manage-users')` are hidden from users without that permission.
2. **Policy Check**: It checks `Gate::allows()` against route actions automatically.
3. **Authentication**: Guest users only see Public routes (e.g., Login, Register). Authenticated users see what their role allows.

**Note for API Users:**When using the API (`/api/cortex/search`), ensure you send the request with an Authenticated Session (cookies) or Bearer Token. Unauthenticated requests will be treated as "Guest".

---

� Advanced Customization
------------------------

[](#-advanced-customization)

Publish the configuration file to define custom actions and searchable models.

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

### Defining Searchable Models

[](#defining-searchable-models)

In `config/cortex.php`:

```
'models' => [
    'product' => [
        'class' => 'App\Models\Product',
        'searchable' => ['name', 'sku'],
        'actions' => [
            'view' => 'products.show',
            'edit' => 'products.edit',
        ]
    ]
]
```

---

🤝 Contributing
--------------

[](#-contributing)

We love contributions! Please submit Pull Requests to the GitHub repository.

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance47

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/85456270?v=4)[AbrarAliMussa](/maintainers/AbrarAliMussa)[@abraralimussa](https://github.com/abraralimussa)

---

Top Contributors

[![AbrarAli14](https://avatars.githubusercontent.com/u/70935986?v=4)](https://github.com/AbrarAli14 "AbrarAli14 (3 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M300](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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