2017 © Pedro Peláez
 

library types

Type classes with built-in validation logic

image

ancarda/types

Type classes with built-in validation logic

  • Sunday, February 4, 2018
  • by ancarda
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

ancarda/types

PHP classes that encapsulate data validation around less precise types, (*1)

Latest Stable Version Total Downloads License Build Status Coverage Status, (*2)

types is a library for PHP 7.0+ that encapsulates validation logic in the constructor of small classes, allowing these already-validated, well-defined instances to be passed around. A "type" here can be anything that has reasonable validation logic, such as an IP address class that wraps a string. By centralizing validation to that class constructor, the whole application can accept and emit an IP address instance knowing the sender and consumer (respectively) don't need to do any validation on what would have been previously a string., (*3)

This is not a new concept; ancarda/types tries to define many common, useful types that can be extended in your application., (*4)

These classes can be used with any framework and have no dependencies other than the built-in JSON extension. This library may be installed via composer with the following command:, (*5)

composer require ancarda/types

Types can then be initalized, like so:, (*6)

<?php

use \Ancarda\Type\Math\UInt8;
$b = new UInt8(102);
// $b can now be passed to a function that accepts UInt8.
// Consumer doesn't need to check $b is 0 to 255.

The Versions

04/02 2018

dev-master

9999999-dev

Type classes with built-in validation logic

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-json >=1.2

 

The Development Requires

25/01 2018

2.0

2.0.0.0

Type classes with built-in validation logic

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-json >=1.2

 

The Development Requires

25/01 2018

1.2

1.2.0.0

Type classes with built-in validation logic

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-json >=1.2

 

The Development Requires

24/01 2018

1.1

1.1.0.0

Type classes with built-in validation logic

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-json >=1.2

 

The Development Requires

24/01 2018

1.0

1.0.0.0

Type classes with built-in validation logic

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-json >=1.2

 

The Development Requires