DEV Community

Claude Code for Symfony and PHP: The Setup That Actually Works

Javier Eguiluz on February 27, 2026

Claude Code is a CLI tool that lets you use AI directly from your terminal to write, edit, and review code in your projects. I've been using it dai...
Collapse
 
matthewhou profile image
Matthew Hou

This is one of the few Claude Code setup posts that actually gets the key insight right — the difference isn't the model, it's the setup.

I've been running a similar approach across different AI tools and the pattern holds everywhere: the projects where I invested in structured config files (CLAUDE.md, project-specific rules) consistently outperform the ones where I just prompted ad hoc. Not by a little — by a lot.

The planning strategy part especially resonates. I've noticed that when I skip the spec-writing step and go straight to "just implement this," the output looks fine superficially but breaks in subtle ways. Co-writing the plan for 1-2 rounds before any code generation has been the single biggest quality multiplier in my workflow.

One thing I'm still figuring out: how to handle config portability when switching between tools. Right now my CLAUDE.md conventions don't transfer cleanly to Cursor's .mdc format, so I end up re-explaining the same project context. Curious if you've run into that with the Symfony setup — or if you're all-in on Claude Code and it doesn't matter.

Collapse
 
joppedc profile image
JoppeDC

Solid post Javier, perfect for those wanting to improve their Claude Code skills! (Pun intended)

Collapse
 
damienalexandre profile image
Damien Alexandre

Thanks a lot for writing this ; plenty of good advices 👍

Collapse
 
harsh2644 profile image
Harsh

Getting there required trial and error' — this is the most honest thing about AI tooling articles and I appreciate you leading with it. Everyone talks about how amazing these tools are but nobody shares the setup pain. The fact that you've been using it daily on real Symfony and EasyAdmin projects gives this article actual credibility. Bookmarking this for when I get to the PHP stage of my learning journey!

Collapse
 
spike31 profile image
Gilles Gauthier

Great article!

You’re missing the concept of rules — they let Claude enforce standards and be triggered only for specific paths.

Collapse
 
javiereguiluz profile image
Javier Eguiluz

Thanks Gilles. Can you please share a link to Claude Code docs where they explain rules? I'd like to learn about them. Thanks!

Collapse
 
spike31 profile image
Gilles Gauthier

Maybe here code.claude.com/docs/en/memory#org...

In Claude Code, rules can be scoped by path: a global rule might say “Use Symfony 7 with PHP 8.3,” while a rule for src/Controller/ enforces #[Route] attributes and one for src/Command/ enforces #[AsCommand], or explain how tests must be writed.
Without rules, you have to load this on your claude.md, it's load a lot of tokens.

Thread Thread
 
spike31 profile image
Gilles Gauthier

Then try Anthropic’s official plugin called Feature Dev to create plans. Over time, you can build your own agent or command to customize it with your rules and skills.
And some only see the future using the Ralf Loop concept.
github.com/anthropics/claude-plugi...

I'm not an expert, just my point of view 🧐

Collapse
 
xwero profile image
david duymelinck

The skill example seems wrong to me, that is more a plugin example.

The biggest difference between skills and plugins is that plugins are always explicitly called and skills can be on demand or loaded into context based on prompt that is given.

Also a skill doesn't recognize allowed-tools frontmatter.

Collapse
 
javiereguiluz profile image
Javier Eguiluz

Good call. This is defined as a command on my computer (~/.claude/commands/fix.md).

But, when preparing the blog post I read this: code.claude.com/docs/en/skills that shows this message: "Custom slash commands have been merged into skills."

That's why I did a last minute edit to turn the command into a skill. But, this was wrong and I've just reverted this. Thanks for reporting this issue.

Collapse
 
charlesbasis profile image
Charles Valerio Howlader

Thanks for sharing!

Collapse
 
matthewhou profile image
Matthew Hou

Solid setup. One thing I'd add: the CLAUDE.md file is where most of the leverage is for framework-specific workflows like Symfony.

The pattern I've found most effective is putting Symfony conventions that Claude can't infer from code into CLAUDE.md — things like "always use constructor injection, never use get() from container" or "run php bin/phpunit --filter ClassName after modifying any service class." Claude reads this before every task, so your conventions become automatic.

The interesting question right now is portability. If you switch to Cursor or Copilot tomorrow, that CLAUDE.md knowledge is stranded. AGENTS.md (supported by 25+ tools now) is trying to solve this — same instructions, every tool reads them. For PHP/Symfony specifically, having test commands and code style rules in a tool-agnostic format means you don't lose your setup when you experiment with a new editor.