Kirby Toolkit

The Kirby Toolkit

A stripped down and easy to use toolkit for PHP

Kirby Toolkit is the heart and soul of my main projects – Zootool and the Kirby CMS. It's open source, so feel free to use it however you like.

The Kirby Toolkit is by no means a full featured mvc/wtf framework, it's more like jQuery for PHP. The Kirby Toolkit is there to make nerdy things a little less nerdy.

Follow the Kirby Toolkit and the Kirby CMS on Twitter: @getkirby or
become a fan on Facebook

Key Features

  • Database Handling (MySQL)
  • Loads of string and array helpers
  • File and directory handling
  • Session and Cookie helpers
  • Browser detection
  • Easy language support
  • Easy request handling
  • Validation
  • Easy app configuration

Code Samples

Easy database handling

<?php

require_once('kirby.php');

// setup the database
c::set('db.host', 'localhost');
c::set('db.user', 'root');
c::set('db.password', 'password');
c::set('db.name', 'database');

// select all users from an imaginary user table
$users = db::select('users', '*');

// build a list of encoded email addresses
// with a fallback for users without an email address
foreach($users AS $user) {
    echo str::email( a::get($user, 'email', 'no email') );
}

?>

Requests and validation

<?php

require_once('kirby.php');

if(get('submit')) {
   
    $email = get('email');

    if(!v::email($email)) {
        echo 'That is not a valid email address';
    } else {
        db::insert('newsletter', array('email' => $email));
        go('/success');
    }
   
}

?>
<form>
  <input type="text" name="email" />
  <input type="submit" name="submit" value="Subscribe" />
</form>

Requirements

Kirby likes PHP 5, Apache on unix systems and MySQL. Everything else is not supported.

Feedback

Please let me know if you like Kirby or you hate Kirby or whatever: bastian.allgeier@gmail.com

Fork me on GitHub