Archive for April, 2008

Web Framework

Friday, April 18th, 2008

Attached is a copy of a very very alpha stage web framework I just made. I took most of the code from a site I’m developing, and removed the site specific stuff from it. It’s fairly advanced, just not fully complete.

Features includes:

An interactive command line mode (pipe your email, run cron jobs, all through the same application, with complete separation from the web interface)
An advanced controller/view architecture (no models yet).
Controllers run in a fully virtual environment (virtual IP, session, etc), allowing unit testing of practically anything.
A database revision system
An advanced exception model for comprehensive error reporting and logging
Maximum security with session hijacking and HTML/SQL injection prevention

Keep in mind, this is not CakePHP or Ruby on Rails. It doesn’t do as much for you, but in turn it provides maximum flexibility. This is not a “for dummies” framework, you have to know what you’re doing but it has major potential. Absolutely every line of code is written with maximum flexibility and modularity in mind.

It’s attached in a zip. Barely any documentation, if you have any questions at all though feel free to ask me.

Alpha Web Framework

Updated type hinting patch

Tuesday, April 15th, 2008

Added type checking for default values and disallowing of null values on parameters without a null default.

Scalar Type Hinting Patch (04-15-2008)

URL Builder Class

Saturday, April 12th, 2008

This class allows you to build URLs using an easy object oriented interface.

Example:

// My blog

$url = new sb_url;
$url -> setDomain(’www.sambarrow.com’);

echo $url -> generate() . ‘<br />’;

// My blog archives

$url -> setPath(’/archives’);

echo $url -> generate() . ‘<br />’;

// My blog (using SSL)

$url -> setPath(’/');
$url -> setProtocol(sb_protocol_https);

echo $url -> generate() . ‘<br />’;

Download:

URL Builder Class

Fully object oriented + strongly typed PHP

Friday, April 11th, 2008

I wrote a few classes today allowing you to use all of your types as objects (like in Java).

$string = new vstring(’Hello!’);
$upper = $string -> upper();
echo $upper -> get();

This will output “HELLO!”

Strong PHP Types