HomePHP Sanitizing User Input for an MVC-based Framework in PHP 5
Sanitizing User Input for an MVC-based Framework in PHP 5
In this fourth part of the series, I show you how to provide this sample MVC-driven framework with the ability to sanitize user input by way of a basic input class.
As you may know, the Model-View-Controller design pattern is one of the most popular standards used nowadays for building web programs that keep business and application logic isolated from visual presentation. The great news about this structural paradigm is that you, as a PHP developer, can also exploit its functionality when developing your own web-based applications.
The MVC design pattern can be applied in multiple situations and projects; this includes the construction of frameworks. Well-established frameworks like the Zend Framework and Ruby on Rails, to cite a couple of examples for different scripting languages, have implemented this approach very successfully for rapid application development.
However, you may want to learn how to use the MVC paradigm for building a basic framework in PHP 5, either for expanding your existing programming skills, or only for fun. If that's the case, in this group of articles you'll find a step-by-step guide that will show you how to create an MVC-based framework using PHP 5, which you can use as a starting point for building your own, or for understanding more clearly how other frameworks function internally.
Of course, if you've already read the three articles that precede this one, then you'll have a more accurate idea of how to build a framework like the one mentioned above. In those tutorials I started creating the framework's front controller and its default ".htaccess" file, and based upon this initial structure I added a few more components, including a router/dispatcher module and a MySQL abstraction class.
Even so, this sample framework in its current state lacks many features that I plan to incorporate in future tutorials. In this one, though, I'm going to provide it with the ability to basically sanitize user-supplied data through a simple input class.
Want to find out how this brand new class will be developed? Then click on the link below and start reading now!