DevShed: Improving Exception Throwing when Auto Loading Classes in PHP 5
79987
DevShed continues their looks at autoloading classes in PHP5 today with this new tutorial focusing on catching and handling any errors that might be thrown in the process.   This is the third article in the series on how to auto load classes in PHP 5. This article will demonstrate how to trigger exceptions in a way that can be caught by the corresponding "catch()" block.  [...] Nonetheless, this issue can be fixed with relative ease. That will be the goal of this third article of the series. So if you're interested in learning how this solution will be implemented, don't waste any more time and start reading now!   They start by looking at throwing an exception with the __autoload so that the script can catch it. The go back to mention the method they'd talked about before - using just eval() - and then show the "new and improved" method of handling the result with a try/catch block instead of a direct output.
372556
Latest PHPClasses.org Releases:GmAtomclass splashAJAX LockingFormat ConverterGPX Mapper & CMSClass Email SenderWeb Server Infosimple XMLPhoto AlbumMisc StringValidator4FieldsasessioncPanel ToolsLeap year checker
703914
On his blog, Stuart Herbert has a quick tip showing how to mimic a feature of Ruby on Rails:   I'm still working on the next article in my series looking at PHP on servers, so in the mean time, check out this simple way to emulate Ruby's nice way of handling separate getter, setter and state query methods in PHP.   He admits his example isn't as elegant as the Ruby method, but it does get the job done. Code for the method is included in his post ready for cut and pasting.
317911
DevShed takes a look at another of the design patterns in a new series starting with this new tutorial - a look at the implementation of Adapter objects in PHP.   You may have already encountered situations in coding PHP applications in which you would like to use inheritance, but could not for one reason or another. Fortunately, there is an alternative for these situations that can help you achieve the same result. In this first article in a two-part series, you'll learn about the adapter pattern.   They start off with the basics of the Adapter pattern and move quickly into the first definition of a class using them - a directory processor. Once that's built, they show how it all works with a more practical example.
154133
Tony Freixas has posted a new article covering his thoughts on high-performance debugging with PHP5:   In this article, I will show you how to use PHP 5 input filters to support debug, trace and assert statements so that a one-line change disables these statements and restores your script to full production performance.   He makes a custom solution, a simple method for just outputting simple debug statements via his own custom debugging classes - thDebug, theTrace and thAssert. He wraps all of these in a thDebugManager class to make them all play nice together.   With these in place, he moves on to the real key to the debugger, using the input filter extension that comes with PHP5. He makes a thAbstractStreamFilter abstract class to base the filtering on and, using this interface, makes his thDebugFilter class to handle the various debugging outputs. He uses the __autoload functionality to load it correctly into each page that needs it.
235642
Latest PHPClasses.org Releases:convertSimple navigationPHP TablesXML ClassSitemap creator for Google, Yahoo and MSNPHPBiDiSimplePaginatorSortable ElementsSnPayPalApiMBTemplate ClassHTTP ServerXCS Parser
386588
Latest PHPClasses.org Releases:Smarty and MIME message integrationYour SayphpPhotoGalleryInterfacesIlariaParser 7just7.comaDB PDO like database abstractionSAMP Socket
575210
Popular posts from PHPDeveloper.org for the past week:PHP-Coding-Practices.com: How I Turned A Slow Array Sort Into A Quick One Using Quicksort AlgorithmZend Developer Zone: PHP Abstract Podcast Episode 4: Planning ProgrammingWeb Development Blog: Save bandwidth with PHProxy and ip2nationJob Posting: Assembleron Ltd Seeks PHP 5/MySQL/Ajax Developers (Reading, UK)PÃ¡draic Brady's Blog: Complex Views with the Zend Framework - Part 6: Setting The TerminologyThe Bakery: Four New Articles - Load Balancing, Request Info, UUID Behavior & Upload ThumbnailsCommunity News: PEAR Installer version 1.6.0 releasedChristopher Kunz's Blog: Building PHP with cURL and libmysqlclient5DevShed: Working with Prepared Queries with PDO Objects in PHP 5Secunia.com: rPath update for gd, php, php-mysql, and php-pgsql
494480
DevShed charges right ahead with its emphasis on design patterns in PHP with a new start of a new series today that looks at the Flyweight pattern.   Among the considerable variety of structural design patterns that can be implemented with PHP 4 (and PHP 5, by the way), there's one in particular that deserves special attention. It's easy to apply in the context of a given web application, and it offers remarkable functionality when it comes to preventing the unnecessary instantiation of different classes. This two-part series covers that pattern.   As they explain, the Flyweight pattern helps to keep your code light and simple by preventing the instantiation of unneeded objects and resources. They go with a HTML form example, illustrating how to prevent a submit button or an input button's class to be reinitialized every time a new form field is needed.
568782
DevShed has posted the next-to-last (part four) of their series looking at destructors in PHP5 applications today. This time they focus on passing information back out of the destructors as the script is finishing.   In this fourth article of the series I'm going to teach you how perform this process when working with multiple objects (remember that you already learned how to achieve this using only one class instance).   They start simple, showing how to handle one object to give you a base to work from. They modify this to expand it out and show the management instead of three different user data objects.
413172
Mike Lively is happy about one thing - that late static binding (definition) has been committed and will be included with PHP 5.3. Unfortunately, he has a downside too:   The good news is late static binding has been introduced into head and looks like it will be merged into 5.3 before it is released. The horrible news is I really don't think the patch went as far as it needs to.   He talks about the original intention of the functionality (flexible inheritance for static methods/properties/constants) and how it was implemented, but with one small issue - that "static will ALWAYS return the 'resolved' name of the class used to call the current function". He illustrates with a code example showing an extended class returning a static property.   He also mentions two suggestions to help fix this issue:   setting the behavior of parent:: such that it forwards the calling class through the next function call. introducing another scope [...] using a new keyword so parent:: could remain the same
321583
Latest PHPClasses.org Releases:NodeezMySQLList content of directoryPablosky MySQLRImageManipulatorMySQL PaginationHTTP LocaleMySQL DB Class with  Data Manipulation Class TimeTaMeREasy PHP ValidationFiltreatmentImage to ASCII textKDoubleMetaphoneGeo Conversion
463548
On the PHPClasses.org website there's a new entry covering, among other things, one handy feature PHP includes to let developers read and write their data more flexibly - streams.   This article explains what are stream handlers and how they simplify PHP developers lives by allowing PHP applications to easily read and write data from containers, like remote Web pages or e-mail messages, as if they were files. [...] The article also presents more examples of cool stream handlers classes submitted to the PHPClasses site by several authors.   He describes the abstraction that the streams interface allows, how they can make your life easier, a real-life example of streams in action (working with POP3) and some of the classes that have been contributed to PHPClasses.org that use them.
318761
DevShed ramps up another new series today with this new article giving developers a look at working with object-oriented programming through the eyes of design patterns. It's another excerpt from the George Schlossnagle book "Advanced PHP Programming".   This chapter provides an overview of the advanced OO features now available in PHP. Some of the examples developed here will be used throughout the rest of this book and will hopefully serve as a demonstration that certain problems really benefit from the OO approach.   The article lays down the foundation for the more complex information to come. It introduces object-oriented programming briefly, and talks about some of the handy features of it - like inheritance, static attributes and methods.
632471
Latest PHPClasses.org Releases:URI CacheEnTransliterationHtmlCreate CSVText Helper ClassLista Paginacao ClassshagaConfiguratorldap_classBrute ForceMulti-thread SimulationiCaptchaFAPDFID3Tiny P2P
376184
DevShed starts off another design patterns series with this new article introducing the Mediator class pattern - a method to keep things up to date and synchronized in your PHP application.   Well, in this case, the synchronization between a group of PHP classes can be made by implementing a useful pattern widely known as "mediator." In short, when the mediator pattern is applied, there's a single class that implements the logic required to keep all the other classes completely synchronized with each other. This means that not only will all the modifications introduced by one class be reflected in the others, but that those changes will be performed via the interface of the mediator class.   They Apply this pattern with their traditional example of working with files - this time the class will handle the communication (and syncing) between two file handling objects. They add a file handling class on to the back end and apply them both in an example that lets you manipulate the data inside both files at the same time.
732440
The International PHP Magazine has posted results from their latest PHP community poll as voted on by visitors to their site. The question for this poll asked developers what they thought, of the choices on the list, was the most common mistake that PHP developers make.   Coming in at number one by an overwhelming lead was "Not escaping entities and SQL input" (a definite problem indeed) with the next highest option, "Not using a Framework" a full twenty percent lower. The next two options were closer (descending) - "Using old PHP versions" and "No or little use of Object Orientation".   There's a new poll this week for your consideration - this time asking which stage, of the five options, should come first in the development cycle of a typical content management system. Head on over and cast your vote today!