PHPackages                             domtomproject/easy-rest-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. [HTTP &amp; Networking](/categories/http)
4. /
5. domtomproject/easy-rest-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

domtomproject/easy-rest-bundle
==============================

Symfony bundle for fast implementing REST actions

v1.0.3(9y ago)2121MITPHPPHP ^7.0

Since Mar 10Pushed 8y ago2 watchersCompare

[ Source](https://github.com/DomTomProject/EasyRestBundle)[ Packagist](https://packagist.org/packages/domtomproject/easy-rest-bundle)[ RSS](/packages/domtomproject-easy-rest-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (4)Used By (0)

EasyRestBundle
==============

[](#easyrestbundle)

**It's bundle for fast and clean validating and setting data. Bundle use [Respect/Valiadtion](https://github.com/Respect/Validation) library and there are all validation rules.**

Basic use
---------

[](#basic-use)

Installation

```
    composer require domtomproject/easy-rest-bundle "dev-master"

```

Or in composer.json

```
   "domtomproject/easy-rest-bundle": "dev-master"

```

And

```
    composer update

```

In AppKernel.php

```
    $bundles = [
      ...
      new DomTomProject\EasyRestBundle\DomtomEasyRestBundle(),
      ...
    ]

```

In config.yml

```
    domtom_easy_rest: ~

```

For first you need to create rules file. Default validation files path is *app/Resources/validation*. For this example we create User.yml

```
default: # its a key
    name:
        - notEmpty
        - stringType
    age:
        - notEmpty
        - intType
    sex:
        - notEmpty
        - in: [[male, female]]
    language_with_skill:
        - keySet:
            - $key:
                - pl
                - $in: [[intermediate, basic, none, national ]]
            - $key:
                - en
                - $in: [[intermediate, basic, none, national ]]

```

Look at $ symbol . If -keySet argument is a function you must use $ symbol otherwise you pass assoc array with key 'key' to this. Starting function have not $ symbol. This yaml file is equivalent with:

```
/* static version */
use Respect\Validation\Validator as v; return array (
  'default' =>
  array (
    'name' => v::notEmpty()->stringType(),
    'age' => v::notEmpty()->intType(),
    'sex' => v::notEmpty()->in(["male", "female"]),
    'language_with_skill' => v::keySet(v::key("pl", v::in(["intermediate", "basic", "none", "national"])), v::key("en", v::in(["intermediate", "basic", "none", "national"]))),
  ),
);

/* 'new' version, used for caching (because it's little bit faster) */
use Respect\Validation\Rules; return array (
  'default' =>
  array (
    'name' => new Rules\AllOf(new Rules\NotEmpty(), new Rules\StringType()),
    'age' => new Rules\AllOf(new Rules\NotEmpty(), new Rules\IntType()),
    'sex' => new Rules\AllOf(new Rules\NotEmpty(), new Rules\In(["male", "female"])),
    'language_with_skill' => new Rules\AllOf(new Rules\KeySet(new Rules\Key("pl", new Rules\In(["intermediate", "basic", "none", "national"])), new Rules\Key("en", new Rules\In(["intermediate", "basic", "none", "national"])))),
  ),
);

```

This file is cache created from yml.

Now you can use this rules.

```
  use AppBundle\Entity\User;

  ...

  $validator = $this->get('domtom_easy_rest.validation');
  $rules = $this->get('domtom_easy_rest.rules')->getDefault(User::class);
  /* can be string like 'User', getDefault(User::class) equals get(User::class, 'default'),
  where 'default' is a key in yml
  */

  if(!$validator->validate($data, $rules)){
            return new JsonResponse($validator->getErrors());
  }

  $validData = $validator->getValidData();

  // now if you use FillableEntityTrait in your entity you can pass this valid data to setFromData method
 $user->setFromData($validData);

```

To test this we send request with JSON.

```
{
  "name": "John",
  "sex": "male",
  "language_with_skill": {
    "pl": "intermediate",
    "en": "national"
  },
  "age": 30
}

```

In this example everything going to work.

Configurable data is:

```
    domtom_easy_rest:
        rules_directory: %kernel.root_dir%/Resources/Validation # if you want change validation files directory
        rules_parser_service: domtom_easy_rest.yaml_rules_parser # if you want change parser, thats service name. Builded are
                                                                 # yaml_rules_parser and php_rules_parser
        cacher_service: domtom_easy_rest.cacher # like in rules_parser_service
        serializer_service: jms_serializer # bundle uses jms_serializer ,but you can use serializer you want

```

For rules customization check [Respect/Valiadtion](https://github.com/Respect/Validation)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 63.2% 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

2

Last Release

3342d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ed2c7670224d53a1f01e55e3d45e83b697e61f80b658bf44608179a00bec279?d=identicon)[DomTomProject](/maintainers/DomTomProject)

---

Top Contributors

[![pajso96](https://avatars.githubusercontent.com/u/19478539?v=4)](https://github.com/pajso96 "pajso96 (48 commits)")[![tomsonis](https://avatars.githubusercontent.com/u/13666319?v=4)](https://github.com/tomsonis "tomsonis (16 commits)")[![DomTomProject](https://avatars.githubusercontent.com/u/25922861?v=4)](https://github.com/DomTomProject "DomTomProject (12 commits)")

---

Tags

validationrest

### Embed Badge

![Health badge](/badges/domtomproject-easy-rest-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/domtomproject-easy-rest-bundle/health.svg)](https://phpackages.com/packages/domtomproject-easy-rest-bundle)
```

###  Alternatives

[league/openapi-psr7-validator

Validate PSR-7 messages against OpenAPI (3.0.2) specifications expressed in YAML or JSON

55615.9M69](/packages/league-openapi-psr7-validator)[aboutcoders/job-bundle

A symfony bundle for asynchronous job processing.

2618.0k1](/packages/aboutcoders-job-bundle)[ecentria/ecentria-rest-bundle

Goal of this bundle is to simplify process of creating APIs with Symfony. We use already well-coded libraries, combine them together to simplify process and not to re-invent the wheel. We've chose REST and HATEOS to have unified standards of API requests and responses.

142.4k](/packages/ecentria-ecentria-rest-bundle)

PHPackages © 2026

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