News Feed
Sections




News Archive
feed this:

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

ServerGrove Blog:
Symfony2 components overview Validator
March 04, 2014 @ 12:55:35

The ServerGrove blog has posted their latest in-depth look at one of the many components that make up the Symfony2 framework. In this latest post they cover the Validator component, another well-used part of the framework.

In the first five posts of this series we have been talking about key components for any PHP framework from the point of view of their internals, such as HttpFoundation to abstract the HTTP protocol, HttpKernel to convert a Request into a Response, Routing to map requests to controllers, EventDispatcher to add reusability and extensibility, and Config to load and validate configuration values. This time we'll delve deeper in the user space to describe a component that is for specific apps rather than just for frameworks. Today's topic will be the Validator component.

They start off talking about a common problem in web applications, running validation on incoming data, and how the component can help. The article then gets into the architecture of the component and provides a simple example of it in use (validating an integer range). They talk about some of the built-in validations, the internationalization support and validation on objects, just just simple values. Finally, there's a look at creating custom validations, their example being a simple check on a given "programming language" string.

0 comments voice your opinion now!
symfony2 component overview validator tutorial

Link: http://blog.servergrove.com/2014/03/03/symfony2-components-overview-validator

Symfony Blog:
Help Symfony reach 3 billion people
January 17, 2014 @ 11:53:02

The Symfony project wants your help to allow this popular PHP framework to reach more people all around the world (3 billion, according to them) by helping out with translations in the Validator and Security component.

Internationalization has been one of the pillars of the Symfony success since the very beginning. Besides providing tools to translate both the strings and the contents of your applications, Symfony itself is translated into a lot of different languages. [...] Some of these translations are incomplete or haven't been updated for a long time. For that reason, we are organizing a community initiative to improve the internationalization of Symfony.

The strings they're talking about are in the Validator and Security components and are currently in 20 different languages. They've broken up the ones they're needing help on into a few categories:

  • Completed translations
  • Incomplete translations
  • Unavailable translations
  • Additional translations

Obviously, they'd love ones from any of the last four in that list and they include a few steps on how to grab the latest version of Symfony and get translating.

0 comments voice your opinion now!
symfony project framework translate message validator security

Link: http://symfony.com/blog/help-symfony-reach-3-billion-people

Jeremy Kendall:
PHP Password Hashing A Dead Simple Implementation
January 08, 2014 @ 11:48:23

In this recent post to his site Jeremy Kendall shares some of his thoughts about password hashing and a new library he's written to help make it simpler - event with an existing password hashing method in place.

We all know to encrypt passwords for highest level of security. Unfortunately, too many do it [the wrong way]. While there was never any excuse for getting it that wrong, there's now no excuse for getting it wrong at all. Developers, meet the new(-ish) PHP password hashing functions (and the userland implementation password-compat).

He shows how to use this password hashing correctly with the "default" hash and how to store that in the database. His Password Validator library aims to help make this even simpler and adds in other features like rehashing and upgrading of legacy passwords. The remainder of the post shows how to use the library for these functions and how to persist them in the tool's storage decorator and interface functionality.

0 comments voice your opinion now!
password hashing implementation validator opensource library

Link: http://jeremykendall.net/2014/01/04/php-password-hashing-a-dead-simple-implementation/

Symfony Blog:
Static Page Caching & Payment Validators in Symfony 2.2
December 12, 2012 @ 11:46:39

On the Symfony blog, there's two new posts highlighting some recent improvements to the Symfony2 framework - the addition of static page caching and payment validators:

These features are all a part of the upcoming Symfony 2.2 release that's planned to be moved in the "stabilization" status in early 2013. It should be able two months following that when the stable version will be released.

0 comments voice your opinion now!
symfony framework page caching payment validator


MaltBlue.com:
Zend Form Mastery with Zend Config - Part 4 Configuring Zend Validators
June 05, 2012 @ 11:25:45

On the MaltBlue blog Matt has posted the latest part of the "Zend_Form with Zend_Config" series, part four looking at using and configuring some form validators.

Welcome to the fourth and final part in the Zend Form Mastery with Zend Config series. Previously we looked at the basic form options, element and form wide prefixes, filters and element options. In this installment, we're going to look at configuring Zend Validators via our XML config. [...] To go in to all of them will take more time than is allowed in the confines of this article. So we're going to work through 5 of the more interesting and likely used ones.

He covers the validation for: email addresses, postal codes, seeing if a record exists in the database, IBAN validation and checking to see if a value is in an array. He gives XML examples for each of these validation methods including the definitions of options and error/feedback messages.

0 comments voice your opinion now!
zendform zendconfig configure validator tutorial xml


Henrik Bjørnskov's Blog:
Symfony2 Using the validator symfony1 style
February 03, 2012 @ 11:15:01

In this quick new post to his blog Henrik Bjørnskov shows how to use the validators in Symfony2 in a more traditional Symfony 1 style for a form.

Two of the more complicated components in Symfony2 is the Form and Validator component. The Validator is created in such a way it "always" need an Domain Object with Constraints associated through metadata. This is explained in detail here. But there is another way. A way that resemble's the symfony1 forms. Where you could specify the validations directly in your form class.

Code is included in the post to show how to load in a few of the validators (like NotBlank, Email and Choice) and how to use them in the settings defined in the "getDefaultOptions" method.

0 comments voice your opinion now!
symfony2 validator form symfony1 options


DevShed:
Building Concrete Validators
December 22, 2011 @ 11:24:25

On DevShed.com today there's the first part of a two-part series showing how to build self-contained validator objects that can be used to test the format of user input for validity.

In this two-part tutorial, I show why the use of static helper classes can be detrimental to building robust and scalable object-oriented applications in PHP (though you should take into account that the concept is language agnostic). I also implement a set of instantiable, fine-grained validators, which can be easily tested in isolation, injected into the internals of other objects, and so forth.

Their set of "concrete validators" are all based off of a validator interface/abstract class and check things like email formatting, floats, integers and URLs. Also included are a few examples of using the validators in a sample script.

0 comments voice your opinion now!
validator tutorial test data interface abstract class


Simas Toleikis's Blog:
Idea for a PHP Validator
October 08, 2010 @ 13:48:26

Simas Toleikis has posted an interesting idea for a validator that would look at the incoming source of an application/script and determine what the requirements for it might be.

How about creating a PHP code validator? Got this idea by looking at tokenizer and reflection extensions. I doubt I will find the time to work on this myself but then someone else might be interested to pick it up. From user's point of view there will be a form made of a large textarea box and a single file upload input. One could paste code snippet on that textarea or upload a ZIP'ed source code archive (or a single .php file) for validation.

His proposed result would show a list of "Required Extensions", PHP versions, E_STRICT compatibility and possibly total lines of code in the project. He points out a few issues that might pop up in writing such a tool such as the requirement for it to be able to use the tokenizer extension itself (a sort of catch-22 since it's not always installed).

0 comments voice your opinion now!
validator idea requirements application reflection tokenizer


Jani Hartikainen's Blog:
Validating Zend_Forms using model objects
May 08, 2009 @ 10:27:30

Jani Hartikainen has posted a three-step process to his blog about handling the information submitted into a Zend_Form instance with a model.

Zend_Forms, models, validation and how they all work together is a tricky topic. There are many opinions and many ways to do it. This time I'll show you what I think could be the answer to validating forms without having to duplicate validation code both in a model class and in your form.

He creates a simple model interface (with get, set, isValid and getMessages methods) and a validator extended from Zend_Validate_Abstract to pass the information back into the model through an isValid method call. The validator is then added to each element you want to use it on in the addElement call on the Zend_Form object.

0 comments voice your opinion now!
validate zendform model object validator isvalid addelement zendframework


Symfony Blog:
Call the expert How to implement a conditional validator?
September 05, 2008 @ 12:06:18

On the symfony blog today, there's a new post that looks at creating a conditional validator in the context of a classic login form for the framework.

Jon works on a symfony 1.1 project with a classic login form. The form is composed of two fields: a username and a password. The validation rules are quite straightforward: he wants each field to be required and he wants to check the correctness of the password.

They show how to set up a normal login widget and how to apply a sfValidatorCallback in the configure() method to check the values in the form. This method checks the username and password values and tosses an error with sfValidatorError if a problem is found.

0 comments voice your opinion now!
conditional validator tutorial symfony framework



Community Events





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


series language release introduction refactor framework wordpress podcast community laravel api install unittest interview threedevsandamaybe list developer testing code opinion

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