symfony

Symfony expert guidance: assist developers in using the enterprise PHP framework Symfony—leveraging its component architecture, Doctrine ORM, dependency injection, event system, security component, API Platform (for REST/GraphQL), and Messenger (for asynchronous processing)—to build production web applications and APIs capable of handling large-scale traffic.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "symfony" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-405fb8dd1772254ac5a826b9e1872511cb25707329436c4102f34cbae3c0f335. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Symfony expert guidance: assist developers in using the enterprise PHP framework Symfony—leveraging its component architecture, Doctrine ORM, dependency injection, event system, security component, API Platform (for REST/GraphQL), and Messenger (for asynchronous processing)—to build production web applications and APIs capable of handling large-scale traffic.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: symfony
description: >-
  You are an expert in Symfony, the enterprise PHP framework for building web
  applications and APIs. You help developers build production systems with
  Symfony's component architecture, Doctrine ORM, dependency injection, event
  system, security component, API Platform for REST/GraphQL, and Messenger for
  async processing — the backbone of enterprise PHP used by companies
  processing billions of requests.
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: Backend Development
  tags:
    - php
    - framework
    - enterprise
    - api
    - doctrine
    - dependency-injection

Symfony — Enterprise PHP Framework

You are an expert in Symfony, the enterprise PHP framework for building web applications and APIs. You help developers build production systems with Symfony's component architecture, Doctrine ORM, dependency injection, event system, security component, API Platform for REST/GraphQL, and Messenger for async processing — the backbone of enterprise PHP used by companies processing billions of requests.

Core Capabilities

Controllers and Routing

<?php
// src/Controller/UserController.php
namespace App\Controller;

use App\Entity\User;
use App\Repository\UserRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Validator\Validator\ValidatorInterface;

#[Route('/api/users')]
class UserController extends AbstractController
{
    public function __construct(
        private UserRepository $users,
        private EntityManagerInterface $em,
        private ValidatorInterface $validator,
    ) {}

    #[Route('', methods: ['GET'])]
    public function list(Request $request): JsonResponse
    {
        $page = $request->query->getInt('page', 1);
        $limit = $request->query->getInt('limit', 20);
        $users = $this->users->findPaginated($page, $limit);
        return $this->json($users, 200, [], ['groups' => ['user:list']]);
    }

    #[Route('', methods: ['POST'])]
    public function create(Request $request): JsonResponse
    {
        $data = json_decode($request->getContent(), true);
        $user = new User();
        $user->setName($data['name']);
        $user->setEmail($data['email']);

        $errors = $this->validator->validate($user);
        if (count($errors) > 0) {
            return $this->json(['errors' => (string) $errors], 400);
        }

        $this->em->persist($user);
        $this->em->flush();
        return $this->json($user, 201, [], ['groups' => ['user:detail']]);
    }

    #[Route('/{id}', methods: ['GET'])]
    public function show(User $user): JsonResponse
    {
        return $this->json($user, 200, [], ['groups' => ['user:detail']]);
    }
}

Doctrine Entity

<?php
// src/Entity/User.php
namespace App\Entity;

use App\Repository\UserRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Validator\Constraints as Assert;

#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: 'users')]
class User
{
    #[ORM\Id, ORM\GeneratedValue, ORM\Column]
    #[Groups(['user:list', 'user:detail'])]
    private ?int $id = null;

    #[ORM\Column(length: 100)]
    #[Assert\NotBlank, Assert\Length(min: 2, max: 100)]
    #[Groups(['user:list', 'user:detail'])]
    private string $name;

    #[ORM\Column(unique: true)]
    #[Assert\NotBlank, Assert\Email]
    #[Groups(['user:detail'])]
    private string $email;

    #[ORM\Column(type: 'datetime_immutable')]
    #[Groups(['user:detail'])]
    private \DateTimeImmutable $createdAt;

    public function __construct()
    {
        $this->createdAt = new \DateTimeImmutable();
    }

    // Getters/setters...
}

Messenger (Async Processing)

<?php
// src/Message/SendWelcomeEmail.php
namespace App\Message;
class SendWelcomeEmail {
    public function __construct(public readonly int $userId) {}
}

// src/MessageHandler/SendWelcomeEmailHandler.php
namespace App\MessageHandler;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;

#[AsMessageHandler]
class SendWelcomeEmailHandler {
    public function __invoke(SendWelcomeEmail $message): void {
        $user = $this->users->find($message->userId);
        $this->mailer->send(/* ... */);
    }
}

// Dispatch from controller:
$this->bus->dispatch(new SendWelcomeEmail($user->getId()));

Installation

composer create-project symfony/skeleton my-app
cd my-app
composer require webapp                   # Full web app
# OR
composer require api                      # API only (API Platform)

Best Practices

  1. Dependency injection — Let Symfony autowire services; define interfaces for swappable implementations
  2. Doctrine migrations — Use bin/console doctrine:migrations:diff to generate migrations from entity changes
  3. Serialization groups — Use #[Groups] to control which fields are serialized per context (list vs detail)
  4. Validation — Use constraint attributes on entities; validate before persisting
  5. Messenger for async — Dispatch messages for heavy work (emails, reports); process with workers
  6. API Platform — Use API Platform for instant REST/GraphQL CRUD from Doctrine entities; customize with attributes
  7. Security voters — Use voters for authorization logic; cleaner than checking roles in controllers
  8. Events — Use EventDispatcher for cross-cutting concerns; decouples components

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • Symfony 企业级 PHP 框架的专业支持,涵盖控制器、路由、Doctrine ORM、依赖注入、事件系统、安全组件、API Platform、Messenger 异步处理等核心技术
  • 适用于构建生产级 Web 应用和 API,面向后端开发者解决实际开发痛点,属于高频刚需工具
Trigger Precision90/100

Highlights

  • description 清晰描述了 Symfony 专家角色及核心能力,触发词完整覆盖 Symfony 相关技术栈(如 Doctrine、API Platform、Messenger 等),边界清晰
Structure and Standards90/100

Highlights

  • 文档结构清晰,包含 Core Capabilities、Installation、Best Practices 等章节,提供端到端代码示例(控制器、实体、Messenger),frontmatter 完整
Execution Reliability90/100

Highlights

  • 代码示例参数正确,工具来源明确(Symfony 官方组件),覆盖了主要异常处理(如验证错误),不可逆操作(如数据库写入)有验证机制
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.