PHPackages                             rohit-raj-verma/pimcore-validation-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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. rohit-raj-verma/pimcore-validation-bundle

ActivePimcore-bundle[Validation &amp; Sanitization](/categories/validation)

rohit-raj-verma/pimcore-validation-bundle
=========================================

Pimcore bundle to add complex field validation rules in class definitions

v1.0.0(4mo ago)01MITJavaScriptPHP &gt;=8.1

Since Feb 13Pushed 4mo agoCompare

[ Source](https://github.com/rohit-raj-verma/pimcore-validation-bundle)[ Packagist](https://packagist.org/packages/rohit-raj-verma/pimcore-validation-bundle)[ RSS](/packages/rohit-raj-verma-pimcore-validation-bundle/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

PimcoreValidationBundle
=======================

[](#pimcorevalidationbundle)

A Pimcore bundle that adds complex field validation rules directly in the class definition editor. Define validation constraints like alpha, alphanumeric, numeric, email, phone, regex patterns, length limits, and numeric ranges per field. Validation is enforced when saving data objects.

Features
--------

[](#features)

- **Class Definition Integration**: Configure validation rules directly in the class editor for each field
- **Multiple Validation Formats**:
    - **Alpha**: Only letters (a-z, A-Z) and spaces allowed
    - **Alphanumeric**: Only letters, numbers, and spaces allowed
    - **Numeric**: Only numeric values allowed
    - **Email**: Valid email address format
    - **Phone**: Valid phone number format
    - **Regex**: Custom regular expression pattern
    - **Length**: Minimum and/or maximum character length
    - **Range**: Minimum and/or maximum numeric value
- **Required Field Validation**: Mark fields as required with custom error messages
- **Custom Error Messages**: Define user-friendly error messages for each validation rule
- **Visual Indicators**: Fields with validation rules display a visual indicator in the object editor
- **Inline Error Display**: Validation errors are shown directly on the field when saving fails

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

[](#requirements)

- Pimcore 11.x
- PHP 8.1 or higher

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

[](#installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require rohit-raj-verma/pimcore-validation-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Add the bundle to your `config/bundles.php`:

```
return [
    // ...
    PimcoreValidationBundle\PimcoreValidationBundle::class => ['all' => true],
];
```

### Step 3: Install the Bundle (Create Database Table)

[](#step-3-install-the-bundle-create-database-table)

```
bin/console pimcore:bundle:install PimcoreValidationBundle
```

This creates the `pimcore_validation_field_rules` table to store validation configurations.

### Step 4: Clear Cache

[](#step-4-clear-cache)

```
bin/console cache:clear
```

Usage
-----

[](#usage)

### Adding Validation Rules to a Field

[](#adding-validation-rules-to-a-field)

1. Navigate to **Settings &gt; Data Objects &gt; Classes** in Pimcore admin
2. Open your class definition (e.g., Product)
3. Select a field in the class tree (e.g., `sku`, `email`, `price`)
4. In the field settings panel, locate the **Validation** fieldset
5. Configure the validation options:
    - **Enable validation**: Turn validation on/off for this field
    - **Required**: Make the field mandatory
    - **Format**: Select the validation type
    - **Error message**: Custom message shown when validation fails
6. Save the class definition

### Validation Format Options

[](#validation-format-options)

FormatDescriptionAdditional OptionsNoneNo validation-AlphaLetters only (a-z, A-Z, spaces)-AlphanumericLetters and numbers only-NumericNumeric values only-EmailValid email format-PhoneValid phone number format-RegexCustom regex patternRegex pattern (without delimiters)LengthCharacter length limitsMin length, Max lengthRangeNumeric value limitsMin value, Max value### Examples

[](#examples)

#### SKU Field - Alphanumeric Only

[](#sku-field---alphanumeric-only)

```
Format: Alphanumeric
Error message: SKU must contain only letters and numbers

```

#### Email Field - Email Validation

[](#email-field---email-validation)

```
Format: Email
Required: Yes
Error message: Please enter a valid email address

```

#### Price Field - Numeric Range

[](#price-field---numeric-range)

```
Format: Range
Min value: 0
Max value: 99999
Error message: Price must be between 0 and 99999

```

#### Product Code - Regex Pattern

[](#product-code---regex-pattern)

```
Format: Regex
Regex: ^[A-Z]{3}-[0-9]{4}$
Error message: Product code must match format XXX-0000

```

#### Description Field - Length Limits

[](#description-field---length-limits)

```
Format: Length
Min length: 10
Max length: 500
Error message: Description must be between 10 and 500 characters

```

How It Works
------------

[](#how-it-works)

1. **Class Definition Save**: When you save a class definition, the bundle intercepts the request and extracts validation configurations for each field, storing them in the `pimcore_validation_field_rules` database table.
2. **Object Save**: When a data object is saved, the bundle listens to the `PRE_UPDATE_VALIDATION_EXCEPTION` event, retrieves the validation rules for the object's class, and validates each field value against its configured rules.
3. **Validation Failure**: If validation fails, a `ValidationException` is thrown with the error message, and the field is marked invalid in the UI with inline error display.

Database Table
--------------

[](#database-table)

The bundle creates a table `pimcore_validation_field_rules` with the following structure:

ColumnTypeDescriptionidINTPrimary keyclassIdVARCHAR(64)Pimcore class IDfieldNameVARCHAR(190)Field nameconfigTEXTJSON-encoded validation configurationmodificationDateINTLast modification timestampUninstallation
--------------

[](#uninstallation)

To remove the bundle and its database table:

```
bin/console pimcore:bundle:uninstall PimcoreValidationBundle
```

Translations
------------

[](#translations)

The bundle includes English translations. To add additional languages, create translation files in `translations/admin.{locale}.yml`:

```
pimcore_validation_title: 'Validation'
pimcore_validation_enable: 'Enable validation'
pimcore_validation_required: 'Required'
pimcore_validation_format: 'Format'
pimcore_validation_format_none: 'None'
pimcore_validation_format_email: 'Email'
pimcore_validation_format_phone: 'Phone'
pimcore_validation_format_regex: 'Regex'
pimcore_validation_format_alpha: 'Alpha'
pimcore_validation_format_alphanumeric: 'Alpha Numeric'
pimcore_validation_format_numeric: 'Numeric'
pimcore_validation_format_length: 'Length'
pimcore_validation_format_range: 'Range'
pimcore_validation_regex: 'Regex (without delimiters)'
pimcore_validation_min_length: 'Min length'
pimcore_validation_max_length: 'Max length'
pimcore_validation_min_value: 'Min value'
pimcore_validation_max_value: 'Max value'
pimcore_validation_message: 'Error message (optional)'
```

License
-------

[](#license)

This bundle is released under the MIT License.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance74

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Unknown

Total

1

Last Release

141d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/14f0454e0b58557e15cd349a425aad845269014257efa282f693757235004819?d=identicon)[rohitrajv5](/maintainers/rohitrajv5)

---

Top Contributors

[![rohit-raj-verma](https://avatars.githubusercontent.com/u/261393979?v=4)](https://github.com/rohit-raj-verma "rohit-raj-verma (3 commits)")

### Embed Badge

![Health badge](/badges/rohit-raj-verma-pimcore-validation-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/rohit-raj-verma-pimcore-validation-bundle/health.svg)](https://phpackages.com/packages/rohit-raj-verma-pimcore-validation-bundle)
```

###  Alternatives

[pimcore/data-hub

Pimcore Datahub

1361.4M12](/packages/pimcore-data-hub)[pimcore/skeleton

126200.6k](/packages/pimcore-skeleton)[coreshop/core-shop

CoreShop - Pimcore eCommerce

292205.0k11](/packages/coreshop-core-shop)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

46855.5k5](/packages/pimcore-data-importer)[pimcore/studio-ui-bundle

Pimcore Studio Ui Bundle

29118.5k19](/packages/pimcore-studio-ui-bundle)[pimcore/studio-backend-bundle

Pimcore Studio Backend Bundle

20203.9k22](/packages/pimcore-studio-backend-bundle)

PHPackages © 2026

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