News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rafael Dohms' Blog:
Filtering objects using annotations
August 12, 2011 @ 10:04:37

Rafael Dohms has an interesting new post to his site today looking at a library he's developed (inspired by the Symfony Validation library) to help filtering values with rules defined in annotations.

PHP does not have native Annotations support, however many projects have been using doc blocks to add value and semantics to code, like PHPUnit, Doctrine and Symfony. The Doctrine did a really good job in making available a Annotation parser kit, which allows you to bring the power of annotations into you own project. This opens up a few possibilities.

He shows the current use of the Validation library with a sample check of a $name variable for "not blank". His tool, DMS, extends this functionality and gives you access to both custom filtering methods and standard PHP functions to filter the resulting variable value. He includes an example showing two variables with filters StripTags, StripNewlines and Trim as well as the code to execute the filtering. You can get the library either ready to integrate with Symfony/Doctrine or as a standalone tool.

1 comment voice your opinion now!
filtering symfony annotations validation library


blog comments powered by Disqus

Similar Posts

NetTuts.com: Aspect-Oriented Programming in PHP with Go!

PHPBuilder.com: Capture Screenshots in PHP with GrabzIt

PHPImpact Blog: Server-side Marker Clustering with PHP and Google Maps

SitePoint PHP Blog: Integrating Polymer/Dart and Symfony Part 1

Giri Mandalika's Sun Blog: MySQL Native Driver for PHP, mysqlnd


Community Events

Don't see your event here?
Let us know!


list community voicesoftheelephpant extension podcast framework php7 series example language release laravel5 library version interview laravel introduction unittest api opinion

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework