granam/strict-string

This package is abandoned and no longer maintained. The author suggests using the granam/string package instead.

Lightweight string container with strict checks

1.2.2 2015-09-16 14:57 UTC

This package is not auto-updated.

Last update: 2016-03-16 21:04:26 UTC


README

Note: requires PHP 5.4+

<?php
use Granam\Strict\String\StrictString;
use Granam\Strict\String\Exceptions\WrongParameterType;

$string = new StrictString('12345');

// foo
echo $string;

try {
  new StrictString(12345);
} catch (WrongParameterType $stringException) {
  // Strict string has to get a string value. Integer is not a string.
  die('Something get wrong: ' . $stringException->getMessage());
}