php|works Toronto Conference 2006: Day 3

Today was a light day, with only 3 talks and the day ending by 12:30pm. The highways were a mess this morning, I barely made it in time for the first talk. I’ll link to slides as they become available. Here is a quick summary of the presentations I listened in on…

9:00am – 10:00am: PHP-GTK2 by Andrei Zmievski

GTK natively is designed to work with many languages, but PHP? I guess if you really love PHP (and totally hate C), then this is for you, when making desktop application. I’ve havent used PHP-GTK extensively, but I can’t imagine it would scale well for large applications. Regardless, the talk was interesting to see whats new in PHP-GTK2, especially when it was coming from its creator.

Andrei’s Slides

10:15am – 11:15am: Handling Data Without Databases by Elliott White III

For one reason or another, it’s possible that a PHP developer would not have access or want to use a database in their application. This talk covered just that, what could a programmer do when database access is not an option. Eli covered five way to go about this, I’ll cover each briefly..

Filesystem Database

In a Filesystem database, every table and row in your database would become its own directory. This is not a requirement, but thats generally what would happen. With a good directory structure and smart intermediate PHP code to control file access, this could be a decent alternative to standard databases. Eli has examples and code in his slides.

XML

XML is surprisingly similar to a filesystem database, just in this case the directory structure becomes the tags, while the data gets stored directly in the XML. With strong XML support in PHP 5, this could be one of the easier solutions.

PHP Files

This gets into slightly more complex ways of storing data, but can be really effective, especially when using some of the built in capabilities of PHP. If you have an array you want to store in a file or XML, why not just call var_export() and store the resulting string in another PHP file? var_export([array]) takes an array, and returns a string array definition, that could be used to re-generate the array. Just write this string to a PHP file, and include() it as needed.

Serialize/Unserialize

I most commonly use serialization to store objects or data during page transitions. Behyond that, serialization is a great way to store objects in files, databases, etc. Read more about serialization here. I had an interesting problem a little while ago, on how to serialize a class using the __sleep() function.

SQLite

SQLite emulates (mimics) a relational database entirely in memory. All data is stored in a single flat file, which makes backing up and getting at your data easy. These days SQLite is very powerful and gives you a lot of the functionality you would normally expect in a standard relational database. Since this is really just faking a relational database, use it with care and only for small amounts of data.

Eli’s Slides

11:30am – 12:30pm: PHP and Mail: Best Practices by Wez Furlong

This was filled with lots of good information, but brought back bad memories of my battles with email related issues (server configurations, etc). In retrospect, I should have sat in on another talk, since I’ve had so much experience in this area. These days I use the PEAR-Mail package for most of my email related needs.

Wez’s slides

Related Articles:

Follow me on Twitter!

Your Ad Here

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>