Create Full-Featured Agentic Applications in PHP
[!IMPORTANT] Get early access to new features, exclusive tutorials, and expert tips for building AI agents in PHP. Join a community of PHP developers pioneering the future of AI development. Subscribe to the newsletter
Before moving on, support the Neuron AI community giving a GitHub star ⭐️. Thank you!
What is Neuron?
Neuron is a PHP framework for creating and orchestrating AI Agents. It allows you to integrate AI entities into your PHP applications with a powerful and flexible architecture. We provide tools for the entire agentic application development lifecycle, from LLM interfaces, data loading, multi-agent orchestration, to monitoring and debugging. In addition, we provide tutorials and other educational content to help you get started using AI Agents in your projects.
Why Neuron
Your next application will be agentic. A growing share of new software is no longer a web application with AI features added along the way, but an application born agentic, where the agent is the architecture itself, driving how the system reasons, acts, and talks to the user interface. Building this kind of application requires a specific set of foundations: event-driven workflows with checkpointing, human-in-the-loop, interruption, multi-agent orchestration, streaming, and agentic UI integration like AG-UI and the Vercel AI SDK, MCP connectors, and asynchronous execution.
Each one is a chapter of the documentation: Workflow, Human in the loop, Streaming & UI protocols, MCP, Async.
There is also no second framework waiting for you when the project grows. The same Workflow that runs your first agent in the getting started guide runs a multi-agent system with state, loops, and human approvals in production. What you learn on day one is what you ship in future projects.
A Vertical & Independent Ecosystem
Neuron is also the only vertical ecosystem for agentic applications development in PHP. Around the framework there is a registry of extensions, tools, and technologies designed specifically for agentic applications, and a growing number of companies building on the same architecture instead of assembling their own from scattered parts.
For a software house or a product company this is a place to be recognized as a specialist rather than one more team claiming AI experience. For a company that needs an agentic foundation it can commit to for years, it means standardizing on an architecture whose whole direction is this space, not a general-purpose library where AI is a side feature. It also means hiring becomes a solvable problem: as the community grows, so does the number of developers who already know how to design, test, and run agentic applications on this architecture, so the people you bring in tomorrow speak the same language as the system you are building today.
Requirements
- PHP: ^8.1
Official documentation
Go to the official documentation
How To
- Getting Started
- Monitoring
- AI Providers
- Tools & Toolkits
- MCP Connector
- Structured Output
- RAG
- Workflow
- AI Assisted Development
- Security Vulnerabilities
- Official Documentation
Getting Started in 3 Steps
1) Install
composer require neuron-core/neuron-ai
2) Create an Agent
Neuron provides you with the Agent class you can extend to inherit the main features of the framework and create fully functional agents. This class automatically manages some advanced mechanisms for you, such as memory, tools, up to RAG (Retrieval Augmented Generation). You can go deeper into these aspects below.
Let's create an Agent with the command below:
vendor/bin/neuron make:agent DataAnalystAgent
<?php
namespace App\Neuron;
use NeuronAI\Agent\Agent;
use NeuronAI\Agent\SystemPrompt;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Anthropic\Anthropic;
class DataAnalystAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new Anthropic(
key: 'ANTHROPIC_API_KEY',
model: 'ANTHROPIC_MODEL',
);
}
protected function instructions(): string
{
return "You are a data analyst expert in creating reports from SQL databases.";
}
}
3) Talk to the Agent
Send a message to the agent to get a response from the underlying LLM:
$agent = DataAnalystAgent::make();
$response = $agent->chat(
new UserMessage("Hi, I'm Valerio. Who are you?")
)->getMessage();
echo $response->getContent();
// I'm a data analyst. How can I help you today?
$response = $agent->chat(
new UserMessage("Do you remember my name?")
)->getMessage();
echo $response->getContent();
// Your name is Valerio, as you said in your introduction.
As you can see in the example above, the Agent has memory of the ongoing conversation. Learn more about memory in the documentation.
Monitoring & Debugging
Many of the Agents you build with Neuron will contain multiple steps with multiple invocations of LLM calls, tool usage, access to external memories, etc. As these applications get more and more complex, it becomes crucial to be able to inspect what exactly your agent is doing and why.
The best way to take your AI application under control is with Inspector. After you sign up,
make sure to set the INSPECTOR_INGESTION_KEY variable in the application environment file to start monitoring:
INSPECTOR_INGESTION_KEY=fwe45gtxxxxxxxxxxxxxxxxxxxxxxxxxxxx
After configuring the environment variable, you will see the agent execution timeline in your Inspector dashboard.
Learn more about Monitoring in the documentation.
Supported LLM Providers
With Neuron, you can switch between LLM providers with just one line of code, without any impact on your agent implementation. Supported providers:
Tools & Toolkits
Make your agent able to perform concrete tasks, like reading from a database, by adding tools or toolkits (collections of tools).
<?php
namespace App\Neuron;
use NeuronAI\Agent\Agent;
use NeuronAI\Providers\AIProviderInterface;
use NeuronAI\Providers\Anthropic\Anthropic;
use NeuronAI\Agent\SystemPrompt;
use NeuronAI\Tools\ToolProperty;
use NeuronAI\Tools\Tool;
use NeuronAI\Tools\Toolkits\MySQL\MySQLToolkit;
class DataAnalystAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new Anthropic(
key: 'ANTHROPIC_API_KEY',
model: 'ANTHROPIC_MODEL',
);
}

