What's this then?
Buan is very small, yet powerful framework for PHP 5. The main features to be excited about are:
- A very small footprint. The whole framework is currently only 275 KB.
-
The role of the Model, View and Controller elements is very clearly defined and simple to understand, ie.
You execute a Controller's action which results in a View which you then render to output. - You can extend the Model, View and Controller classes to completely customize their functionality.
- A self-contained ORM supports all model-to-model relationships, such as 1:M, M:M and recursive variations on these.
- Views are not mapped to Controller actions. Rather than pre-mapping Views to actions, you have full control over what View templates are used at any point within the script execution.
- By default PHP is used for View templates, but you can theoretically support any templating system you wish by extending the View class.
It's not as meaty as some other frameworks because it doesn't include a massive library of functions and helpers. Instead you are free to write your own or use third-party functions to meet your specific needs.
Why would I use this over another framework?
Perhaps because you like the name?
The world is saturated with PHP frameworks which all end up performing the same tasks. As always it's all down to preference and until you've actually written and executed code within any of them there's no way to know if it's going to be to your liking or not.
I'd urge you to give Buan a go anyway. Set aside an hour one day to have a taste. You may end up wasting an hour of your life, or you may have just spent the most productive hour of your life and never look back!
Download
As of this writing there are no tagged versions of Buan, but you can grab the latest development snapshot from a couple of sources:
Daily snapshot
http://www.thundermonkey.net/builds/buan-trunk.tar.gzSubversion
http://code.google.com/p/buan/source/checkoutDocumentation
As of right now there is little documentation to be had. The primary entry point for getting up and running is the bundled INSTALL.txt file, but once you've got an installation up and running there is also some inline documentation which expands on the ideas behind the framework.
NOTE: Some of the documentation may in fact be completely out of date, which is pretty unhelpful. Buan has gone through a fair few changes since it's birth and perhaps the documentation has failed to keep up. Anyway, bear this in mind when following the manual - if something doesn't work after reading it form the manual then you know why! I'll resolve this as soon as time allows.
"Hello, World" Benchmark
This isn't a real-life benchmark, but gives you an idea of how Buan compares to the same benchmark on other frameworks.
The following results were achieved on an Intel Core 2 Duo (E6600) with 1GB RAM running Win XP, Apache 2.2.3 and PHP 5.2.4:
> ab -c10 -t60 http://localhost/hello-world
Document Path: /hello-world
Document Length: 13 bytes
Concurrency Level: 10
Time taken for tests: 60.000 seconds
Complete requests: 10291
Failed requests: 0
Write errors: 0
Total transferred: 2037816 bytes
HTML transferred: 133796 bytes
Requests per second: 171.52 [#/sec] (mean) (the equivalent benchmark for static HTML was 2023 req/s)
Time per request: 58.303 [ms] (mean)
Time per request: 5.830 [ms] (mean, across all concurrent requests)
Transfer rate: 33.17 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.2 0 31
Processing: 0 57 15.6 62 171
Waiting: 0 56 15.6 62 171
Total: 0 57 15.6 62 171
And here's the source code for the various files:
/* GlobalViewController.php */
class GlobalViewController extends Controller {
public function index($params) {
$v = new View();
$v->setSource(Config::get('app.dir.views').'/blank.tpl');
return $v;
}
}
/* HelloWorldController.php */
class HelloWorldController extends Controller {
public function index($params) {
$v = new View();
$v->setSource(Config::get('app.dir.views').'/hellow-world.tpl');
return $v;
}
}
/* blank.tpl */
<?php echo $this->getSlot('action')->render(); ?>
/* hello-world.tpl */
Hello, World!
Feedback and contributions
Buan is the product of a single brain. The comments and suggestions from other people's brains would be very much appreciated in order to move this framework along and improve it's use to a great many people.
In particular it would be useful to hear about:
- Bugs
- Security issues/possible holes
- Identified bottlenecks (and solutions if you have them!)
If you would like to contribute some ideas, or indeed would like to submit some code then please get in touch via buan@thundermonkey.net.
Disclaimers
Use Buan at your own risk! It's an incomplete bit of software for which I offer no guarantees or claims of hardiness so don't expect too much from it at this early stage in it's life :)
This website sucks
You're right. It was knocked up very quickly to give Buan a soapbox on which to preach it's general goodness. Expect something marginally better one day.