Flourish provides a strong, base set of PHP classes that run pretty much anywhere, helping you focus on solving more interesting problems.
Extensive documentation and a sane API help you get stuff done, whether you are building a new app or maintaining a legacy website.
You will find Flourish useful if you need to write code that is any of the following:
Below is an example of how to retrieve all active users from the database and print their name.
// Connect to our SQLite database
fORMDatabase::attach(new fDatabase('sqlite', '/path/to/database'));
// Create an object to represent rows in the database
class User extends fActiveRecord {
// Return an iterable set of User objects
public static function findActive() {
return fRecordSet::build(
'User', // Make User objects
array('status=' => 'Active'), // That are active
array('date_registered' => 'desc') // Ordered by registration date
);
}
}
// Loop through and display the users' names
foreach (User::findActive() as $user) {
echo $user->prepareFirstName() . ' ' . $user->prepareLastName() . '<br />';
}
This example shows how to upload an image, resize it, and make a thumbnail.
// Create an fUpload object to handle the file upload
$uploader = new fUpload();
// Require the user upload an image (with MIME type checking server-side)
$uploader->setMIMETypes(
array('image/jpeg', 'image/gif', 'image/png'),
'Please upload a .jpg, .png, or .gif image'
);
// Move the image and then resize to fit a 500x300 canvas
$image = $uploader->move('/path/to/images', 'image')
->resize(500, 300)
->saveChanges();
// Create a 32x32 thumbnail of the image
$thumb = $image->duplicate('/path/to/thumbs')
->cropToRatio(1,1)
->resize(32,32)
->saveChanges();
Check out the documentation for a list of all of the Flourish classes.