承接 letkode/common-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

letkode/common-bundle

Composer 安装命令:

composer require letkode/common-bundle

包简介

Common exceptions, attributes, value resolvers and utilities for Symfony applications

README 文档

README

Common exceptions, attributes, value resolvers and utilities for Symfony applications.

Installation

composer require letkode/common-bundle

Symfony Flex will register the bundle automatically. If not using Flex, add it manually:

// config/bundles.php
return [
    Letkode\CommonBundle\LetkodeCommonBundle::class => ['all' => true],
];

Contents

Exceptions

All exceptions implement HttpStatusExceptionInterface and map directly to an HTTP status code. Throw them from services — the ExceptionListener in your project converts them to JSON responses.

Class HTTP
BadRequestException 400
UnauthorizedException 401
EntityNotFoundException 404
TooManyRequestsException 429
ValueObjectException 422
throw new EntityNotFoundException('User not found.');
throw new ValueObjectException('Invalid email.', translationKey: 'errors.email_invalid');

Attributes

#[UniqueField] — Constraint

Validates that a field value is unique in the database via Doctrine.

#[UniqueField(entity: User::class, field: 'email')]
public string $email;

#[MapUuid] — Mapping

Marks a constructor parameter or property for automatic UUID deserialization.

Value Resolver

UuidValueResolver

Automatically resolves Uuid typed route parameters without manual conversion.

#[Route('/users/{uuid}')]
public function show(Uuid $uuid): JsonResponse { ... }

Utils

BuilderUrlClient

Builds absolute URLs using the configured APP_CLIENT_URL base. Requires letkode/helpers-bundle.

JsonReader

Reads and decodes JSON files from the filesystem, throwing on invalid JSON.

Requirements

  • PHP ^8.4
  • Symfony ^7.0 || ^8.0
  • doctrine/persistence ^3.0
  • letkode/helpers-bundle ^1.0

License

MIT — see LICENSE.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固