Download the PHP package somnambulist/laravel-doctrine-entity-validation without Composer

On this page you can find all versions of the php package somnambulist/laravel-doctrine-entity-validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-doctrine-entity-validation

This project is no longer being maintained.

Entity Validation for Laravel-Doctrine ORM

Provides integration between standard Doctrine entities and the Laravel Validator by using Hydrators.

Requirements

Installation

Install using composer, or checkout / pull the files from github.com.

Two new config files will added:

Add the entity class names to the hydrators config file to have hydrators made. Add a mapping between the entity and a rules class in validation to allow the factory class to create Validator instances.

The validation rules should implement the EntityRules contract or extend: Somnambulist\EntityValidation\AbstractEntityRules class. The rules class should contain the basic rules needed to validate the entity. This is NOT form validation! These rules are the basic requirements for your domain entities to be valid.

The validation rules can then be added to your form requests or validation rules. E.g.: a User entity may have EntityRules requiring a name, email and username but in the AddUserFormRequest, Roles and Permissions may be additionally required. The entity rules would look something like:

class UserEntityRules extends AbstractRules
{
    public function supports($entity)
    {
        return $entity instanceof User;
    }

    protected function buildRules($entity)
    {
        return [
            'name' => 'required|min:1',
            'email' => 'required|email|unique:User,email,' . ($entity->getId() ?: 'null'),
            'username' => 'required|alphanum|unique:User,username,' . ($entity->getId() ?: 'null'),
        ];
    }
}

As the entity is passed in, you can access any method and create complex rules.

The entity validation factory can then be type-hinted or fetched from the container:

class SomeClass ...
{
    public function __construct(EntityValidationFactory $validationFactory)
    {
        $this->factory = $validationFactory;
    }
    public function someMethod()
    {
        if ($this->factory->validate($user)) {

        }
    }
}

Generating Hydrators

An extra command is provided to make generating the hydrators easier:

php artisan doctrine:generate:hydrators

These will be cached to the file system in the storage/cache/hydrators folder by default. Configure the storage folder in the hydrators config file.

This command can be added to composer install|update so that the hydrators are created automatically as changes are made or code deployed.

Links


All versions of laravel-doctrine-entity-validation with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
illuminate/validation Version ~5.2
laravel-doctrine/orm Version 1.*
ocramius/generated-hydrator Version ~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package somnambulist/laravel-doctrine-entity-validation contains the following files

Loading the files please wait ....