<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: khaled HAMMROUNI</title>
    <description>The latest articles on DEV Community by khaled HAMMROUNI (@khaled_hammrouni_bc97ab98).</description>
    <link>https://dev.to/khaled_hammrouni_bc97ab98</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2136271%2F494cc26e-18b6-4336-9647-2b4989598719.png</url>
      <title>DEV Community: khaled HAMMROUNI</title>
      <link>https://dev.to/khaled_hammrouni_bc97ab98</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khaled_hammrouni_bc97ab98"/>
    <language>en</language>
    <item>
      <title>Why I keep coming back to PHP, even for AI agents</title>
      <dc:creator>khaled HAMMROUNI</dc:creator>
      <pubDate>Sun, 06 Sep 2026 17:48:11 +0000</pubDate>
      <link>https://dev.to/khaled_hammrouni_bc97ab98/why-i-keep-coming-back-to-php-even-for-ai-agents-39g2</link>
      <guid>https://dev.to/khaled_hammrouni_bc97ab98/why-i-keep-coming-back-to-php-even-for-ai-agents-39g2</guid>
      <description>&lt;p&gt;I've tried the shiny new things.&lt;/p&gt;

&lt;p&gt;Node.js. Python. Go. Rust.&lt;/p&gt;

&lt;p&gt;And you know what ? They're great. They have their strengths. But every time I need to build something for production, something that actually needs to work and stay working, I find myself coming back to PHP. Not because I'm stuck in the past. Because PHP just works.&lt;/p&gt;

&lt;p&gt;Here's the thing about PHP: I can write code at 9 AM, deploy it at 9:15 AM, and it runs. No containers. No orchestration. No 47-step build pipelines. Just FTP (okay, fine, Git push + deploy) and it's live.&lt;/p&gt;

&lt;p&gt;Shared hosting ? Works. VPS ? Works. Serverless ? Also works.&lt;/p&gt;

&lt;p&gt;PHP doesn't get in your way. It does what you ask it to do. No unnecessary complexity. No "you're holding it wrong" moments. It's the programming equivalent of a reliable pickup truck, not flashy, but it gets the job done.&lt;/p&gt;

&lt;p&gt;Then AI happened, suddenly everyone was building agents, RAG systems, and LLM-powered applications. But the ecosystem ? Almost entirely Python. So I tried Python. And I felt like I was spending more time managing environments, fighting with package version conflicts, and learning new paradigms than actually building things. Don't get me wrong, Python is powerful. But for someone who builds PHP applications for a living, it felt like learning a new trade just to add one feature to an existing product.&lt;/p&gt;

&lt;p&gt;The existing PHP solutions weren't much better, every AI library I found was either:&lt;/p&gt;

&lt;p&gt;Embedded inside a massive framework (Laravel, Symfony, etc.)&lt;/p&gt;

&lt;p&gt;Over-engineered with layers of abstractions&lt;/p&gt;

&lt;p&gt;Unmaintained or half-baked&lt;/p&gt;

&lt;p&gt;Or required you to restructure your entire application to use it&lt;/p&gt;

&lt;p&gt;I just wanted something simple. Something I could drop into an existing PHP codebase and get working in 10 minutes. Something that felt like PHP.&lt;/p&gt;

&lt;p&gt;So I built it. Introducing NanoAgentPHP. A lightweight AI agent library for PHP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/hammrouni/nanoagentphp" rel="noopener noreferrer"&gt;https://github.com/hammrouni/nanoagentphp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NanoAgent is live:👉 &lt;a href="https://hammrouni.github.io/nanoagentphp/" rel="noopener noreferrer"&gt;https://hammrouni.github.io/nanoagentphp/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The philosophy:&lt;/p&gt;

&lt;p&gt;✅ Tiny footprint – No unnecessary dependencies&lt;/p&gt;

&lt;p&gt;✅ Does the job – AI agents that actually work in production&lt;/p&gt;

&lt;p&gt;✅ Feels like PHP – No magic, no crazy abstraction layers. Just clean, readable code you can understand in 5 minutes&lt;/p&gt;

&lt;p&gt;What it does:&lt;/p&gt;

&lt;p&gt;Tool/function calling  :Turn any PHP function into an AI tool&lt;/p&gt;

&lt;p&gt;Multi-provider support : OpenAI, Groq, Anthropic, DeepSeek, OpenRouter&lt;/p&gt;

&lt;p&gt;MCP (Model Context Protocol) support : Connect to external MCP servers&lt;/p&gt;

&lt;p&gt;Structured output, RAG, streaming, multi-agent chains&lt;/p&gt;

&lt;p&gt;Built-in safety : Max iteration limits to prevent runaway costs&lt;/p&gt;

&lt;p&gt;Here's how simple it is: I needed to add an AI assistant to a product that processes customer support tickets. The assistant needed to read the ticket, identify the issue, and suggest a response.&lt;/p&gt;

&lt;p&gt;With NanoAgentPHP:&lt;/p&gt;

&lt;p&gt;// Create a tool that fetches a ticket from the database&lt;br&gt;
$getTicket = new FunctionTool(&lt;br&gt;
    name: 'get_ticket',&lt;br&gt;
    description: 'Fetches a customer support ticket by ID',&lt;br&gt;
    callable: function($ticketId) {&lt;br&gt;
        return $db-&amp;gt;query("SELECT * FROM tickets WHERE id = ?", [$ticketId]);&lt;br&gt;
    }&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;// Create the agent with a system prompt&lt;br&gt;
$agent = new Agent(&lt;br&gt;
    provider: new GroqProvider(getenv('GROQ_API_KEY')),&lt;br&gt;
    tools: [$getTicket],&lt;br&gt;
    systemPrompt: 'You are a support assistant. Analyze the ticket and suggest a helpful response.'&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;// Run it&lt;br&gt;
$response = $agent-&amp;gt;run("Ticket #1234 needs a response");&lt;br&gt;
echo $response;&lt;br&gt;
That's it. No migrations. No service providers. No config files. Just PHP. Or if I need to query a knowledge base (RAG):&lt;/p&gt;

&lt;p&gt;$agent = new Agent(&lt;br&gt;
    provider: new OpenAIProvider(getenv('OPENAI_API_KEY'))&lt;br&gt;
);&lt;br&gt;
// Let the agent search your documentation vector database&lt;br&gt;
$result = $agent-&amp;gt;run(&lt;br&gt;
    'How do I reset my password?',&lt;br&gt;
    context: ['knowledge_base' =&amp;gt; $searchResults]&lt;br&gt;
);&lt;br&gt;
The best part ? I can use this in production right now. Deploy it the same way I deploy everything else in PHP. No new infrastructure. No new deployment processes. Just code that works.&lt;/p&gt;

&lt;p&gt;Why am I telling you all this ?&lt;/p&gt;

&lt;p&gt;Because I think we've collectively lost sight of something important. Not every project needs microservices. Not every feature needs a new language. Not every problem needs to be solved with the latest trendy stack. Sometimes, you just need to get the job done. And PHP has always been great at that.&lt;/p&gt;

&lt;p&gt;So if you're a PHP developer looking to add AI capabilities to your applications without the complexity of rewriting everything in Python give NanoAgentPHP a try.&lt;/p&gt;

&lt;p&gt;It's open source. It's MIT licensed. And it's built for people who just want to build things.&lt;/p&gt;

&lt;p&gt;⭐ Star it on GitHub if you find it useful: &lt;a href="https://github.com/hammrouni/nanoagentphp" rel="noopener noreferrer"&gt;https://github.com/hammrouni/nanoagentphp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Would love to hear your feedback, feature requests, or just stories of what you're building with it.&lt;/p&gt;

&lt;p&gt;P.S. The library is tiny, but it's battle-tested. I'm using it in production products right now. If something breaks, you'll find the code simple enough to fix it yourself that's the point.&lt;/p&gt;

&lt;p&gt;P.P.S. If you're wondering "why not just use LangChain ?" LangChain is great. But sometimes I don't need a Swiss Army knife. Sometimes I just need a screwdriver. That's NanoAgentPHP.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>php</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
