symfony
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "symfony":https://skillpi.com/zh/skills/deepskill-405fb8dd1772254ac5a826b9e1872511cb25707329436c4102f34cbae3c0f335。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Symfony 专家指导:针对企业级 PHP 框架 Symfony,帮助开发者利用组件架构、Doctrine ORM、依赖注入、事件系统、安全组件、API Platform(用于 REST/GraphQL)和 Messenger(用于异步处理)来构建用于生产环境、可处理大规模请求的 Web 应用和 API。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 实测状态
- 未测试
文件浏览
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-injectionSymfony — 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
- Dependency injection — Let Symfony autowire services; define interfaces for swappable implementations
- Doctrine migrations — Use
bin/console doctrine:migrations:diffto generate migrations from entity changes - Serialization groups — Use
#[Groups]to control which fields are serialized per context (list vs detail) - Validation — Use constraint attributes on entities; validate before persisting
- Messenger for async — Dispatch messages for heavy work (emails, reports); process with workers
- API Platform — Use API Platform for instant REST/GraphQL CRUD from Doctrine entities; customize with attributes
- Security voters — Use voters for authorization logic; cleaner than checking roles in controllers
- Events — Use EventDispatcher for cross-cutting concerns; decouples components
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- Symfony 企业级 PHP 框架的专业支持,涵盖控制器、路由、Doctrine ORM、依赖注入、事件系统、安全组件、API Platform、Messenger 异步处理等核心技术
- 适用于构建生产级 Web 应用和 API,面向后端开发者解决实际开发痛点,属于高频刚需工具
亮点
- description 清晰描述了 Symfony 专家角色及核心能力,触发词完整覆盖 Symfony 相关技术栈(如 Doctrine、API Platform、Messenger 等),边界清晰
亮点
- 文档结构清晰,包含 Core Capabilities、Installation、Best Practices 等章节,提供端到端代码示例(控制器、实体、Messenger),frontmatter 完整
亮点
- 代码示例参数正确,工具来源明确(Symfony 官方组件),覆盖了主要异常处理(如验证错误),不可逆操作(如数据库写入)有验证机制
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。