Blog

About

Flourish is The PHP Unframework, a general-purpose, object-oriented PHP library designed to reduce code and improve security.

This blog covers both general PHP topics in addition to information about Flourish including some of the architecture, best practices and unique features.

If you are interested in Flourish you may want to download it and then read Getting Started and How Do I…?

Prepared Statement Support Added

Since back in December there has been kind of a lull in activity on Flourish due to some major work adding prepared statement support to fDatabase and re-architecting the tests. The result of this work was a new class added to Flourish, fStatement, that works in combination with fDatabase to provide prepared statement support across all database extensions. You can read more about it in the fDatabase section about Prepared Statements.

A good amount of time was spent adapting the various PHP extension APIs to work with the existing fDatabase::query() style of using data-type-specific placeholders. As you can see below, using prepared statements with Flourish will feel very natural if you have used the other query methods.

// Prepare a statement
$statement = $db->prepare("SELECT * FROM users WHERE user_id = %i");
 
// Execute it any number of times
$user_1 = $db->query($statement, 1);
$user_2 = $db->query($statement, 2);
//

The fDatabase::prepare() method will create an fStatement object out of database-specific SQL string, while fDatabase::translatedPrepare() will translate the SQL throught fSQLTranslation before creating the object. The object can then be passed in place of a SQL string to fDatabase::query() or fDatabase::unbufferedQuery(). Read more


Contributing

Recently there has been some increased interest in contributing to Flourish. If you are interested in helping out with the project, I’m sure that everyone who uses it would be very grateful. The way that things of have been going recently, I’m going to start focusing more on approaching a stable release. Over the past year the beta has helped to improve the available functionality, increase its robustness and work out quite a number of bugs.

As the code moves to a stable release, I foresee more of a focus on improving documentation and writing tests. There are also currently a number of tickets for enhancements, plus there are some items on the original roadmap still to tackle.

So, if you do have interest in contributing to the project, please consider how you may be able to help out with:

Read more


New Oracle Support and More Tests

After some prodding from a few interested parties, I took it upon myself to add Oracle support to Flourish. There now exists full support for Oracle in the fDatabase, fResult, fUnbufferedResult, fSchema and fSQLTranslation classes. I've targeted Oracle 10g since I have free access to that via Oracle Database 10g Express Edition, however I believe almost all of the functionality should work on older versions.

In addition to adding support for Oracle, I took the past couple of months to add over 1800 new tests that exercise all 16 supported database extensions and cover most of the functionality of the fDatabase, fResult, fUnbufferedResult, fSchema and fSQLTranslation classes.

Like other supported databases, the Oracle support in fDatabase will work with any of the available database extensions for Oracle. This includes OCI8, PDO_OCI, ODBC and PDO_ODBC. From my testing, the ODBC extensions only work on Windows because some of the ALTER SESSION commands executed by fDatabase are not supported by the UnixODBC driver. If you have any details on a better way to configure ODBC on Linux/BSD, please let me know. Read more


Discussions and Comments

Just a few days ago I posted links to Flourish on both Hacker News and the PHP Reddit. There has been some great conversation about Flourish on those sites and on a thread over on the CodeIgnitor forums.

If you run across any other conversations, I'd love to hear about them. And as always, please feel free to comment on this post or start a thread with any suggestions or questions you may have.


Flourish Demo Site

If you've never worked with Flourish before, getting started building a site may seem a little daunting. Included below is the description and source code for a production site written with Flourish and SQLite.

The northshorewebgeeks.com site provides a simple list of upcoming and past meetups for the North Shore Web Geeks meetup. Rather than hand-editing the HTML and RSS feeds, Flourish was set up to provide a simple CMS to easily update the information.

Routing

The site is fairly simple, so I set up Apache with mod_rewrite to create some nice, clean URLs:

/                     # -> index.php  : Home/main page
/rss                  # -> index.php  : RSS feed
/manage               # -> manage.php : Lists all meetups
/manage/add           # -> manage.php : Allows adding a meetup
/manage/{date}/edit   # -> manage.php : Allows editing a meetup
/manage/{date}/delete # -> manage.php : Allows deleting a meetup

Read more


SQLite 3.2.8 Binary

If you are working with a server running PHP 5.1.x (such as a VPS with CentOS 4) you may have run into an issue with using SQLite as a database. The version of the sqlite3 command line program is 3.3.6, however the version of the SQLite library used for the PDO SQLite driver is 3.2.8. To complicate matters further, between versions 3.2.8 and 3.3.0 the database file format was changed in a way that databases created by 3.3.0 and newer are not readable by 3.2.8 and before.

In practical terms, this means you can't use the sqlite3 binary provided by the OS to create a database to use with PHP.

Unfortunately the SQLite website has removed all source and binary files for everything before 3.6.x. While I was unable to find a 3.2.8 binary for linux, I was able to find a copy of the source tarball from an old Ubuntu repository, and I have mirrored it here along with a statically linked binary that I compiled.

Downloads

Read more


Announcing the Flourish Beta

After about a year and a half of development and approximately 150k lines of code changes, Flourish is now officially in beta.

Flourish is a general PHP library that is focused on being robust, yet easy to use, secure, portable and well documented. It is specifically not referred to as a framework because it is quite different from most of the PHP MVC frameworks currently available.

Project Overview

Here is a brief overview of the library:

Read more