/toby

A Rack compliant PHP micro framework (read Sinatra) that runs on Rack'em. Put Old Toby in your pipe and smoke some lightweight web applications.

Primary LanguagePHP

Making PHP development fun again.

The finest Leaf in the Southfarthing is also a web framework similar to Sinatra.

Built on Rack'em.

Setting Up

Toby works best with Composer. Add it to your composer.json

{
  "require": {
	  "toby/toby": "dev-master"
	},
	"minimum-stability": "dev"
}
$ composer install

Hello World

<?php
# config.php

require 'vendor/autoload.php';

$app = new \Toby\Base();
$app->get('/',function() {
    return "<h1>Hello World!</h1>";
});
return $app->run();
?>
$ vendor/bin/rackem
$ open http://localhost:9393

What we have so far

  • routing (DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT)
  • route matching ($app->get("/hello/:name");)
  • render templates and layouts
    • currently supported: php,mustache,markdown,haml
  • conditions and filters
  • redirection
  • halting
  • passing routes
  • error handling (error not_found halt(500))
  • logging via Rackem\Logger
  • settings
  • configure blocks (global and per environment)
  • completely Rack complient (using Rack'em)
  • serving static files
  • handling file uploads
  • handling sessions ($app->enable("sessions");)
  • flash messaging ($app->flash("error","Gah! Something happened!");)

What needs doing

  • support for more templating engines. (twig, jade, etc.)