2017 © Pedro Peláez
 

library constraint-violations

This library provides an implementation of the Notification Pattern with additional functionality to keep code DRY and to be more useful in the context of Domain-Driven Design (DDD) and its value objects.

image

fleshgrinder/constraint-violations

This library provides an implementation of the Notification Pattern with additional functionality to keep code DRY and to be more useful in the context of Domain-Driven Design (DDD) and its value objects.

  • Sunday, April 3, 2016
  • by Fleshgrinder
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Build Status Code Climate Test Coverage Packagist Packagist License VersionEye, (*1)

PHP Constraint Violations

This library provides an implementation of the Notification Pattern with additional functionality to keep code DRY and to be more useful in the context of Domain-Driven Design (DDD) and its value objects., (*2)

Installation

Open a terminal, enter your project directory and execute the following command to add this package to your dependencies:, (*3)

$ composer require fleshgrinder/constraint-violations

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*4)

Usage

Most basic usage is as illustrated in the following example:, (*5)

$input = 'some data';
$errors = new ViolationCollector();
$warnings = new ViolationCollector();

if (some_validation($input) === false) {
    $errors->addViolation('some message');
}

if (some_other_validation($input) === false) {
    $warnings->addViolation('some other message');
}

// More validations ...

if ($warnings->hasViolations) {
    echo "WARNINGS\n";
    foreach ($warnings->getMessages() as $message) {
        echo "{$message}\n";
    }
}

if ($errors->hasViolations) {
    echo "ERRORS\n";
    foreach ($warnings->getMessages() as $message) {
        echo "{$message}\n";
    }
    exit(1);
}

// Continue ...

Please have a look at the wiki for more examples., (*6)

License

MIT License, (*7)

The Versions

03/04 2016

dev-master

9999999-dev https://github.com/fleshgrinder/php-constraint-violations

This library provides an implementation of the Notification Pattern with additional functionality to keep code DRY and to be more useful in the context of Domain-Driven Design (DDD) and its value objects.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

validation notification notifications ddd domain-driven design constraints violation martin fowler notification pattern violations

03/04 2016

0.1.0

0.1.0.0 https://github.com/fleshgrinder/php-constraint-violations

This library provides an implementation of the Notification Pattern with additional functionality to keep code DRY and to be more useful in the context of Domain-Driven Design (DDD) and its value objects.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

validation notification notifications ddd domain-driven design constraints violation martin fowler notification pattern violations

25/03 2016

0.0.1

0.0.1.0 https://github.com/fleshgrinder/php-constraint-violations

This library provides an implementation of the Notification Pattern with additional functionality to keep code DRY and to be more useful in the context of Domain-Driven Design (DDD) and its value objects.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

validation notification notifications ddd domain-driven design constraints violation martin fowler notification pattern violations

23/03 2016

0.0.0

0.0.0.0 https://github.com/fleshgrinder/php-constraint-violations

This library provides an implementation of the [Notification Pattern](http://martinfowler.com/eaaDev/Notification.html) with additional functionality to keep code DRY and to be more useful in the context of [Domain-Driven Design](http://www.domaindrivendesign.org/) (DDD) and its value objects.

  Sources   Download

MIT

The Requires

 

The Development Requires

validation notification notifications ddd domain-driven design constraints violation martin fowler notification pattern violations