PHPackages                             letkode/common-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. letkode/common-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

letkode/common-bundle
=====================

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

1.3.0(2w ago)0162MITPHPPHP ^8.4

Since Jun 19Pushed 2w agoCompare

[ Source](https://github.com/letkode/common-bundle)[ Packagist](https://packagist.org/packages/letkode/common-bundle)[ RSS](/packages/letkode-common-bundle/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (20)Versions (9)Used By (2)

letkode/common-bundle
=====================

[](#letkodecommon-bundle)

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

---

Installation
------------

[](#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
--------

[](#contents)

### Exceptions

[](#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.

ClassHTTP`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

[](#attributes)

#### `#[UniqueField]` — Constraint

[](#uniquefield--constraint)

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

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

Use `scopes` to narrow the lookup and/or exclude the record being edited from the check. Each `UniqueFieldScope` resolves a value from a route param or a sibling property, then either `Filter`s the query (via an association) or `Exclude`s a match from the violation:

```
// Update DTO: same email is fine if it's still the record at /users/{uuid}
#[UniqueField(
    entityClass: User::class,
    field: 'email',
    scopes: [new UniqueFieldScope('uuid', UniqueFieldScopeSource::RouteParam, 'uuid', UniqueFieldScopeMode::Exclude)],
)]
public string $email;

// Create DTO: email only needs to be unique within the tenant from /tenants/{tenantUuid}/contacts
#[UniqueField(
    entityClass: TenantContact::class,
    field: 'email',
    scopes: [new UniqueFieldScope('tenant', UniqueFieldScopeSource::RouteParam, 'tenantUuid', scopeEntityClass: Tenant::class)],
)]
public string $email;
```

#### `#[MapUuid]` — Mapping

[](#mapuuid--mapping)

Marks a constructor parameter or property for automatic UUID deserialization.

### Value Resolver

[](#value-resolver)

#### `UuidValueResolver`

[](#uuidvalueresolver)

Automatically resolves `Uuid` typed route parameters without manual conversion.

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

### Utils

[](#utils)

#### `BuilderUrlClient`

[](#builderurlclient)

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

#### `JsonReader`

[](#jsonreader)

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

---

Requirements
------------

[](#requirements)

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

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance97

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

7

Last Release

17d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/562202fef9515226531f2d5c3b8cfc6a0a3a3bb61616204e56e3d93eaec3ed5f?d=identicon)[letkode.app](/maintainers/letkode.app)

---

Top Contributors

[![tjcalma](https://avatars.githubusercontent.com/u/4671171?v=4)](https://github.com/tjcalma "tjcalma (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/letkode-common-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/letkode-common-bundle/health.svg)](https://phpackages.com/packages/letkode-common-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.3M414](/packages/easycorp-easyadmin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M763](/packages/sylius-sylius)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k52.2M366](/packages/api-platform-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M222](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1301.7M2.9k](/packages/contao-core-bundle)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M529](/packages/pimcore-pimcore)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
