 | News Feed |
Sections
|
| feed this: |  |
PHPImact Blog: Refactoring the Front Controller of the Zend Framework
by Chris Cornutt August 20, 2008 @ 14:04:01
The PHP::Impact blog has a new tutorial posted today with a look at a refactoring of the front controller of the Zend Framework to make it a bit more manageable.
One of the most fundamental decision in object design is deciding where to put responsibilities. No one, and I mean no one, gets it right the first time. That's why refactoring is so important. As Kent Beck puts it, refactoring is the process of taking a system and adding to its value, not by changing its behaviour but by giving it more of these qualities that enable us to continue developing at speed.
He follows the "extract" refactoring method that makes things simpler by removing unneeded parts of the code (in favor of an interchangeable external "extract class". He removes seven methods from the class and splits them off into their own. This reduces the controller down to a more manageable size and takes a lot of the complexity out.
voice your opinion now!
tutorial refactor extract class zendframework front controller
C7Y: Practical Uses for the PHP Tokenizer
by Chris Cornutt August 20, 2008 @ 09:31:55
A new tutorial has been posted to php|architects C7Y community site looking at some practical uses of the PHP tokenizer to work with your source.
In this article we take a look at the PHP tokenizer and its potential at analyzing and processing PHP source code. We will build several working examples, which you can start using and extending for your own purposes.
The author, Stan Vassilev, explains what the tokenizer is for, how it parses the code (via a lexer) and how to get at the tokens that are created. He uses the token_get_all and token_name functions to get the information and creates a wrapper class around them to strip whitespace and comments.
voice your opinion now!
tokenizer practical use tutorial strip whitespace filter class
Debuggable Blog: Testing Models in CakePHP - Now let's get rid of the unnecessary ModelTest classes!
by Chris Cornutt July 31, 2008 @ 07:51:38
On the Debuggable blog today Tim Koschutzki looks at another testing topics for the CakePHP framework - a cleaner way for testing models.
Up until now there was always a need to create a so-called test model that extends your model-under-test in order to overwrite its $useDbConfig setting to be 'test_suite'. By that you ensured that your models run with the test_suite datasource when the tests are run. [...] Nate proposed ClassRegistry::config(), which allows you to tell the ClassRegistry class which datasource it shall use when
ClassRegistry::init() is used the next time (and thereby a model is instantiated).
He includes an example of the new functionality - a test case ensuring that three articles are there and are marked as published. The registry makes it easier to automatically create the ArticleTest instance inside the test case rather than having to manually declare and define it.
voice your opinion now!
test case cakephp framework registry modeltest class
DevShed: A Better Way to Determine MIME Types for MIME Email with PHP
by Chris Cornutt July 24, 2008 @ 07:53:18
Continuing on in their look at sending MIME emails with PHP, DevShed has posted a better way for you to determine the correct MIME type of the file you're wanting to send (third part of the series).
I demonstrated how to build a modular MIME mailer class in PHP 4; it was provided with the capacity to send messages in plain text, and to work with different types of file attachments. This class implements a private method, called "getMimeTypes()," which, as its name would suggest, comes in handy for determining the correct MIME type of a given file. [...] However, the logic implemented by this method is rather primitive and can definitely be improved.
They start with a review of the previous code (PHP4) and show how to get the correct mime type of the file based on the extension mapped to an array of types.
voice your opinion now!
mime tutorial type mail php4 class getmimetypes extension
DevShed: Handling Attachments in MIME Email with PHP
by Chris Cornutt July 16, 2008 @ 12:58:17
DevShed has posted the second part of their series looking at handling MIME attachments in PHP generated emails today. This time they focus on the modification of their PHP4 class to make sending the emails easy.
In this second tutorial of the series, I'm going to teach you how to improve the initial structure of the MIME mailer class developed in the first article by giving it the ability to work directly with attachments. Sounds fairly interesting, right? Then don't waste any more time in preliminaries and begin reading this article now!
They refresh you on the code from the former tutorial and show you how to modify it to work with more than just the simple plain-text attachment like before (with binary information, things like JPEGs, PDFs and other text formats like XML and HTML).
voice your opinion now!
attachments mime email tutorial class
DevShed: Sending MIME Email with PHP
by Chris Cornutt July 10, 2008 @ 08:49:20
In this new tutorial on DevShed Alejandro Gervasio explains how to send emails from PHP with MIME payloads attached.
One of the most common tasks that a PHP programmer has to tackle is the development of applications that send MIME email in one form or another. In simple terms, MIME email consists of an extension of traditional email technology and comes in handy for sending email messages in fancy HTML and handling file attachments in a wide variety of formats.
In this first part of the series he just lays the groundwork - creating the mailer class they'll use for the series and using it to send a sample email (a basic message with a plain text MIME block).
voice your opinion now!
mime email tutorial payload class binary
|
Community Events
Don't see your event here? Let us know!
|