Hasin Hayder's Blog: Using ActiveRecord Library Separately from CodeIgniter
615823
On his blog today, Hasin Hayder has a quick tutorial on using one of the features of the CodeIgniter framework outside of it - the ActiveRecord library.   CodeIgniters ActiveRecord library is a nice implementation (though modified) of ActiveRecord design pattern. It comes bundled with CodeIgniter. So if you want to use Just this library in your application individually instead of using full CodeIgniter framework, what to do?   His solution uses an abstraction layer (ActiveRecordFactory) to handle any issues with interfacing to CodeIgniter's class. He's also included the code (and a download
457664
In this post on the Zend Developer Zone, Cal Evans takes a look at an article published in a recent php|architect issue from Chris Hartjes about how several recent advancements in the PHP community have helped developers think more in "the Rails way" of development.   Chris does a good job of laying out his points. As with any article of this nature, you are going to agree with some of them and you'll disagree with some of them. However, to get to that point you'll have to consider all of them. That's really the point of the article; making developer sit back and think for a minute. It's well worth the read.   Cal also mentions some of the topics presented in the article including more conceptual ideas like "Convention Over Configuration" and "Rapid Should Mean Rapid".
177344
P&aacute;draic Brady is back today with the latest installment (part 5!) of his look at complex views in the Zend Framework. This time, her focuses on something called the Two-Step Pattern - a pattern similar to the Layouts pattern.   Part 5 of our series takes a small time-out from approaching a Composite View solution to reusable Views to take a peek at a simpler approach useful for simpler types of web applications. As we've discussed previously Composite Views allow the nesting of reusable View elements, effectively building a View based on a hierarchy of Views. But often there are simpler solutions to simpler problems. One such solution is the Two-Step View pattern, sometimes called Layouts if implemented in a specific way (as we do below!).   He gives the example of a simple website that needs a header and footer on every page. Rather than having to duplicate the header/footer calls across all of the pages, the Layout (Step-Two) pattern defines a single template that contains the header and footer but also uses a "main" area where the content is dynamically inserted.   He includes a full code example to help illustrate the point - a class, Zps_View, that is fed the path to the layouts and the layout files to use before rendering.
744440
On his blog today, Chris Hartjes has a quick screencast he's created showing off an interactive testing console he's worked up for use with the CakePHP framework.   I had suggested in an email to the CakePHP mailing list that an interactive console for doing testing of Models would be good. While at php|tek I spent a lot of time with the CakePHP guys talking about this. Out of it came some more ideas (like the ability to test your routes) and they even implemented a console that spits out API information for you. Very cool stuff. So, I decided to do a little screencast demo of a very early alpha version of the interactive console.   The screencast shows Chris running a test on his own classes, including demonstrating the built-in help the app offers.
402184
Continuing on with his look at his OpenID library and its implementation, Padraic Brady has two new posts with more of the story.   From the first post:   As a follow on from my previous entry about OpenID in the Zend Framework, I've been in brief contact with Dmitry Stogov across a scattering of emails. Dmitry posted his OpenID proposal for the framework over at the Proposals Wiki earlier in the week. [...] It's actually very hard to comment constructively rather than simply handing over my code which probably says a lot more all by itself. [...] Anyway, I've agreed to port my OpenID library to PEAR as a PHP5 package. I checked with the mailing list, and the approach I've taken in splitting the library across a number of freestanding components hasn't seen any objections. On the flipside, it does help by providing upgrades to existing PEAR Encryption packages which are not yet migrated to PHP5 versions.   And from post number two:   Over the weekend, I managed to grab a few hours to dig around my OpenID library with the ultimate development tools: patience and experimentation. [...] What I've refactored towards is a splitting of the OpenID process based on three categories: Request, Redirect, Response.
505235
Stefan Esser is trying to clear up some confusion in a new post to the PHP Security Blog today about his stand on enabling open_basedir on your PHP installation.   From time to time I get the question why I recommend enabling open_basedir and on the other hand call it a solution flawed by design. This is actually a good question, because the untrained PHP user might get a little bit confused about this and might believe that I change my opinion on a daily basis.   He talks about his reasoning - how it does it's job protecting PHP developers from being able to get to those file, but how it's also flawed with issues due to some 3rd party libraries that have their own problems.
611971
Although frankly I really didn't feel the need to read the entire thread, I can tell you that the posting to the PHP 3 mailing list is related to the Smarty Templating Engine back in the day. In fact, I believe this was the original spec Andrei proposed before Smarty even existed. Although I don't remember the exact e-mail, this posting reminded me that there was a point in time I thought exactly this way... quoting myself:
624249
On the Zend Developer Zone, there's a new post pointing to the second part of their look at the Manning Publishing book "PHP in Action".   If you've been anxiously awaiting part two of this series then your wait is over. Here's a short introduction to the section part of this series written by the author of the book, Dagfinn Reiersol. I had the privilege of meeting Dagfinn at phpuk last week. Below the introduction is the link I know youâve been waiting for.   The new PDF they link to focus on two different patterns - the Decorator (a wrapper class) pattern and the Null Object (an object that works like the others but does nothing behind the scenes) pattern.
635920
Popular posts from PHPDeveloper.org for the past week:Padraic Brady's Blog: Complex Views w/Zend Framework - The Final Chapter: ZFE & Zend_Layout in Core!php|architect: Stuff your stockings: single issues 30% offDeveloperTutorials.com: How to Install PHP 5 on LinuxStoyan Stefanov's Blog: Fancy FormattingSymbianOne.com: Your S60 Web server gets a boostAndreas Gohr's Blog: MySimple.php - A lightweight PHPMyAdmin substituteNessa's Blog: Working with Permissions in PHPSymfony Blog: Symfony 1.0.10 is OutMatthew Turland's Blog: Web Scraping Article PublishedJan Lehnardt's Blog: REST Controller for PHP Applications
759924
Chris Hartjes is taking on what he calls his "next foolish project" - a console for the CakePHP framework.   On the CakePHP mailing list, somebody familiar with Ruby on Rails' console functionality asked "why isn't there one of these in Cake?" [...] So I got to thinking about how to do this. On the surface, it seems the easiest way to do this is to write a PHP script that takes entries on the command line, run the input through an 'eval' statement. Sounds easy enough, and I could write that in a hurry. I think the trickiness comes in figuring out how to hook it into CakePHP so that you can access Models that already exist.   For those attending the Vancouver PHP Conference, attend his talk and you might get  amention of how far he's come with the idea. Otherwise, stay tuned to his blog for updates.
416753
On the Zend Developer Zone, jonwage has posted about an ORM (Object-Relational mapping) he came across that can help abstract out your interface with your backend database - Doctrine.   One of its key features is the ability to optionally write database queries in an OO (object oriented) SQL-dialect called DQL inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains a maximum of flexibility without requiring needless code duplication.   The project's page gives the full details on the features it offers and has links to the latest downloads so you can try it out for yourself. There's even a blog you can subscribe to to keep up to date.
515251
In a new post to his blog, Rob Allen takes a look a a package inside of the Zend Framework - one that allows for much more flexibility with the way your site flows.   One of the new features to hit the Zend Framework since 0.7 is Zend_Controller_ModuleRouter and its sibling Zend_Controller_ModuleRewriteRouter. This allows for separating out sets of controlers, models and views into their own modules.   He gives both a directory structure and PHP code example of it in action, both in how it normally functions (looks for a controller with the same name as the request) and an example of how he thinks it should work - complete with code and a directory structure to compare to the previous example.
397724
Padraic Brady has put together a very comprehensive post on his blog today about using the Zend_Feed component of the Zend Framework to help with the aggregation of content from other sites (like RSS and Atom feeds).   In this entry I explore Zend_Feed from the perspective of someone aggregating RSS and Atom feeds with a view to building a database of uniquely identified content for later presentation in a "Planet" style application. [...] In fact all we create here is a simple command line script to aggregate content frequently (e.g. just set up cron to run it every hour or so) into a database for later presentation.   He guides you through each step of the way:   Setting Up Database And Models The Aggregator Script Foundation Using Zend_Feed to get common data for RSS/Atom entries Putting It All Together   There's plenty of code (and SQL to insert) in the post and he explains each point well, helping to make the development process smoother. There's even a summary section to toss in a few extra bits of information just in case you missed them along the way.
150071
On his blog today, Mike Lively has posted about the work h's done to create a database extension for the popular unit testing software for PHP, PHPUnit.   For those that may not have read any of my previous postings on the subject the goal of this software is to extend the functionality of PHPUnit to allow using seed data to put a given database into a known state prior to executing each test. It also provides an easy mechanism to compare database contents with an expected dataset.   Mike has just completed the initial feature set for his project - more or less a port of DBUnit over to PHP. The post includes not only details about this initial release but also code that demonstrates its use. In his example, it's used to validate that a bank account has been created properly by comparng database information before and after the insert.
84402
The Bakery has five new items they've recently posted - a few new articles, helper information and tutorials. Here's the list:   CSV Helper - I was recently outputting some comma-delimited data and thought I would benefit from a simple csv helper p28n, the top to bottom persistent internationalization tutorial - For some developers, allowing a website to support multiple languages is essential. Luckily cakePHP 1.2 has the foundations available to make this possible. Tracking navigation history of a user - Many times it can be very useful to track the navigation history of a user. [...] With this HistoryComponent, it's extremely easy to handle such actions. Habtm hacks to menage columns in both models - I had a habtm relationship between two models and when i did a "findall" in a model i couldn't filter the rows with a clause from the the other model. SecureGet Component - I am not pretending this can replace ACL or more complex implementation, it's just a small component, inspired a bit from the Security component.   If you're a CakePHP developer, you'd do well to check out The Bakery for these and more great Cake-related articles, tutorials and information.
241556
Cody Caughlan has created a project that brings one of the popular features of Ruby on Rails to the world of PHP5 - database migrations.   One of the cool things I like about Ruby on Rails is the use of "migrations" for maintaining your DB. Migrations have proven to be pretty handy in keeping a local database in sync with the work of other developers. [...] Because migrations are incremental and they are done in a structured manner, it is a great way of pushing out new DB changes to the production database servers.   His framework, Ruckusing Migrations, is a modular framework that makes use of some of the more advanced features of PHP5. It's portable (via an adapter interface) and uses a generic task interface (task files) to load functionality into the framework. There's also plenty of API hooks to allow for a developer to easily create their own custom operations.   Check out the project homepage for more information.
751529
Michael Kimsal has come up with the start of a series to introduce PHP developers to the world of Grails (the Java framework).   The comparisons I plan to make will be mostly to PHP, cause that's what I'm most familiar with, though there may be some other comparisons from time to time.  This is a work in progress, but I'd be very interested in feedback from anyone out there interested in this aea - Grails, Groovy, PHP, why another language/platform/framework, etc.   The first two installments have been posted - part one and part two - with an introduction to what Grails is and a brief dip into some "Hello world" sort of code to give you an idea of the structure.