The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

The Neuron AI Framework for PHP and Laravel

Published on by

The Neuron AI Framework for PHP and Laravel image

Neuron AI is a PHP Agentic framework to build production-ready AI-driven applications. Along with the core neuron-ai framework, the neuron-laravel package provides Laravel-specific integration points without limiting access to the core framework components.

This package aims to make it easier for Laravel developers to get started with AI agent development using the Neuron AI framework. Neuron doesn't need invasive abstractions, it already has a very simple syntax, 100% typed code, and clear interfaces you can rely on to develop your agentic system or create custom plugins and extensions.

Using the Laravel package's Artisan commands, you can quickly generate files such as a Nueron agent, a tool, a workflow, and more. Using Nueron, you can extend the Agent class to create agents quickly, providing you with rich features like chat history, tools, etc, and a clean interface:

<?php
 
namespace App\Neuron;
 
use NeuronAI\Agent;
use NeuronAI\SystemPrompt;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Anthropic\Anthropic;
 
class YouTubeAgent extends Agent
{
protected function provider(): AIProviderInterface
{
// return an AI provider instance (Anthropic, OpenAI, Ollama, Gemini, etc.)
return new Anthropic(
key: 'ANTHROPIC_API_KEY',
model: 'ANTHROPIC_MODEL',
);
}
 
public function instructions(): string
{
return (string) new SystemPrompt(
background: ["You are an AI Agent specialized in writing YouTube video summaries."],
steps: [
"Get the url of a YouTube video, or ask the user to provide one.",
"Use the tools you have available to retrieve the transcription of the video.",
"Write the summary.",
],
output: [
"Write a summary in a paragraph without using lists. Use just fluent text.",
"After the summary add a list of three sentences as the three most important takeaways from the video.",
]
);
}
}

As I learned about Neuron, the Chat History feature really stood out to me, providing LLM context out of the box while truncating the conversation to avoid exceeding the LLM content window. Chat history can be stored in-memory, in a file, a database, or any storage you want by implementing the AbstractChatHistory class.

Laravel Neuron Main Features

  • A ready-to-use configuration file for AI providers, embeddings providers credentials
  • A few artisan commands to create the most used components and reduce boilerplate code
  • Facades to automatically instantiate providers and vector stores
  • Ready-to-run migrations if you want to use the EloquentChatHistory component
  • AI coding assistant guidelines integrated with Laravel Boost to help AI write better code

Learn More

While we cannot cover every feature Nueron provides, I recommend starting with the official documentation. It includes details about every part of Nueoron as well as videos. Lastly, check out the example app demonstrating a multi-agent workflow in Laravel.

👨‍💻 The source code is available on GitHub: neuron-core/neuron-laravel

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
PHP DebugBar v3 is released image

PHP DebugBar v3 is released

Read article
The Neuron AI Framework for PHP and Laravel image

The Neuron AI Framework for PHP and Laravel

Read article
What's new in Filament v4.5? image

What's new in Filament v4.5?

Read article
Manage Waitlists in Laravel with Laravel Waitlist image

Manage Waitlists in Laravel with Laravel Waitlist

Read article
Laravel Introduces Official AI Documentation image

Laravel Introduces Official AI Documentation

Read article
Laravel Gets a Claude Code Simplifier Plugin image

Laravel Gets a Claude Code Simplifier Plugin

Read article