Today I released the second public version of my new library PHPTypeSafe. It is now compatible with the current version of PHP 5.3 (right now it is RC2). I think we won't see any major changes with the namespace handling in PHP 5.3 anymore, so I felt I could upgrade the library.
One mayor move is the hosting of the source. I moved the sources from my own public subversion repository to GitHub, as the library is Open Source and may be improved more easily when using git.
PHPTypeSafe still provides the ability to use PHPs Type Hinting feature for scalar values.
So what does PHPTypeHint offer?
By including PHPTypeSafe in your project you will be able to use Parameter Type Hinting for scalar values and the special type resource. A simple example on how to use this functionality would be:
The output would be:
PHPTypeSafe offers the support for the following types:
boolean(including aliasbool)float(including aliasesdoubleandreal)integer(including aliasesintandlong)resourcestring
Every type hint matcher is strict (so '1' won't match with the integer type hint), as you shouldn't use type hints if you aren't sure about the given /required type of value. (Those cases could still be checked using is_string(), is_int() and the like.)
You can get PHPTypeSafe RC2 via git at GitHub or download the PHAR archive at GitHub.


Recent Comments