What is Limb?
Limb is an OpenSource(LGPL) PHP framework mostly aimed for rapid web application prototyping and development. The current actively developed branch of framework is Limb3(there is also Limb2 but it's not maintained anymore).
Limb3 is not a monolithic framework, it's rather a library which consists of many reusable components distributed as packages on Limb3 PEAR channel. Thus you can cherry pick the components you need and combine them with other frameworks and libraries(e.g. ZendFramework, Symfony, PEAR, etc).
Some of the most popular packages include:
- core: the base package which provides lazy loading of PHP code and some advanced OO tools(automatic decorators genarators, transparent object proxies, etc)
- toolkit: dependency injection tools
- macro: a powerful and highly customizable templating system which uses user defined macro tags
- web_app: FrontController and MVC patterns implementation.
- active_record: ActiveRecord pattern implementation(Rails alike)
- dbal: Database Abstraction Layer which supports MySql, PostreSQL, Oracle and SQLite at the moment.
- tests_runner: unit testing tools built around excellent SimpleTest library
- session: transparent PHP session wrappers with painless persistence of objects
- see more packages on Limb3 PEAR channel
If you would like to see Limb3 in action have a look at Code Bits section where you can find code samples as well as applications built on this framework.
More about Limb...Project News
- Latest interesting repository changes
-
submitted by pachanga on 29.03.2008 18:30
Hi! There have been some quite interesting code changes in the repository lately.
Kulyamin "svk" Sergey fixed bugs in the PostgreSQL driver and added experimental support for the Linter database driver in limb/dbal package. Sergey also proposed interesting idea regarding SQL statement execution optimization and after a couple of days the patch was committed. And, finally, svk patched limb/mail package adding capability of images embedding into mail body.
Vasin "vasiatka" Alexey added convenient {{flashbox}} tag for {{macro}} template into limb/web_app package. Here are some possible usage examples:
{{flashbox}}
{{list ....}}
.....
{{/list}}
{{/flashbox}}{{flashbox as='$flash'/}}
{{list using='$flash'....}}
.....
{{/list}}I added a runtests.php script into repository which should simplify tests execution for Limb3 packages. The key idea is to allow running tests right after the code checkout, something as follows:
$ svn co https://svn.limb-project.com/3.x/trunk/limb limb
$ cd limb
$ php runtests.php #run tests for all packages
$ php runtests.php core macro cache #run tests only for specific packagesIn order to make all this possible package tests should be as independent as possible. Fortunately, limb/tests_runner allows to achieve this using proper .setup.php and .skipif.php scripts. The work in this direction is still in the process.
Stanislav "korchasa" Korchagin added {{tree:empty}} tag(analogue of {{list:empty}}) and expanded lmbHttpResponse functionality for more fine grained cookie control in limb/macro and limb/net packages respectively.
And last, but not least, Sergey "syfisher" Yudin fixed lmbSet in limb/core package for edge cases when working with arrays containing "false" values.
Good job, guys, keep your patches coming ;)
- "Projects" section moved into "Code Bits"
-
submitted by pachanga on 11.03.2008 08:10
Projects section previously located at http://projects.limb-project.com was moved into Code Bits which is located at http://bits.limb-project.com. The new name reflects the idea behind this section in a better way and the url is more concise and less verbose to type. BC is preserved, of course, the old section redirects to the new one.
- {{macro}} on-line usage examples
-
submitted by pachanga on 03.03.2008 22:15
Sergey Yudin(syfisher) did really great job by making {{macro}} template engine examples available on-line.
The mentioned page has runnable examples for mostly all core {{macro}} tags. You can browse the template rendering result page, template sources and PHP code which actually works behind the scene.
You can also download the source code of these examples from projects page(where, by the way, you can find some other real life Limb3 usage samples).
We are going to update examples on the regular basis presenting other interesting {{macro}} usage patterns in the future, so, if you are interested, stay tuned.
- limb/active_record experimental eager fetching support
-
submitted by pachanga on 24.02.2008 23:55
Sergey Yudin(syfisher) has added an experimental support for eager fetching in limb/active_record package. Simply put, eager fetching technique greedily grabs as much as possible useful information into memory from database(which is opposed to lazy loading, the default limb/active_record behaviour). This allows to dramatically reduce the amount of additional SQL queries in some cases when lots of interconnected objects are fetched.
For example, in the code below for each Lecture object there will be an additional SQL query selecting its Course object(one-to-many relation)
$lectures = lmbActiveRecord :: find('Lecture');
foreach($lectures as $lecture)
echo 'Lecture '$lecture->getTitle() . ' of ' . $lecture->getCourse()->getTitle() . " course.\n";Thus, if we have 5 Lecture objects having different Courses, there will be 1+5 queries total.
The code above can be rewritten using eager fetching:
$lectures = lmbActiveRecord :: find('Lecture', array('join' => 'course'));
foreach($lectures as $lecture)
echo 'Lecture '$lecture->getTitle() . ' of ' . $lecture->getCourse()->getTitle() . " course.\n";Now there will be only one SQL query fetching all Lecture and connected Course objects using LEFT JOIN construct
limb/active_record currently supports two types of eager fetching: joining(used in the example above) and attaching.
Eager joining
Eager joining can be only used for has_one, belongs_to and many_belongs_to relations. This limitation is due to the fact this type of eager fetching uses LEFT JOIN infrastructure. Nested eager joins are supported as well:
$lectures = lmbActiveRecord :: find('Lecture', array('join' => array('course' => array('join' => 'program'))));There will be only one query made in this case:
SELECT lecture.id AS id, lecture.title AS title, lecture.course_id AS course_id,
course.id AS course__id, course.title AS course__title, course.program_id AS course__program_id,
course__program.id AS course__program__id, course__program.title AS course__program__title
FROM lecture
LEFT JOIN course AS course ON lecture.course_id = course.id
LEFT JOIN program AS course__program ON course.program_id = program__course.idEager attaching
Eager attaching is a more general and a bit more slower operation than eager joining. Eager attaching makes an additional query for each relation(not object!) limiting the amount of fetched data with WHERE .. IN(..) SQL construct. This type of eager fetching is compatible with any type of relation. Nested attaching is supported as well:
$programs = lmbActiveRecord :: find('Program', array('attach' => array('courses' => array('attach' => 'lectures'))));There will be 3 queries done in this case:
SELECT program.id AS id, program.title AS title FROM program;
SELECT course.id AS id, course.title AS title, course.program_id AS program_id
FROM course WHERE program_id IN (...) ORDER BY program_id ASC;
SELECT lecture.id AS id, lecture.title AS title, lecture.course_id AS course_id
FROM lecture WHERE course_id IN (...) ORDER BY course_id ASC;While there are some wrinkles yet to be ironed out(for example, proper Postgres support), eager fetching support has been already successfully tried on a couple of projects.
Want to be on the bleeding edge too? Go for it - try the SVN version of limb/active_record package!
- {{macro}} include and wrap tags unification
-
submitted by pachanga on 24.02.2008 23:10
We have unified {{include}} and {{wrap}} tags for the {{macro}} templating engine and now it's possible to use only one tag for both of these operations. Meet the new experimental tag {{insert}}!
Here's the sample usage:
- Simple static include:
Hello, {{insert file="foo.html"/}}foo.htmlBob
result:Hello, Bob
- Simple dynamic include:
Hello, {{insert file="$file"/}}foo.htmlBob
result(if $file == "foo.html"):Hello, Bob
- Simple static wrap:
{{insert into="slot1" file="foo.html"}}Bob{{/insert}}
foo.htmlHello, {{slot id="slot1"/}}
result:Hello, Bob
- Simple dynamic wrap:
{{insert into="slot1" file="$file"}}Bob{{/insert}}
foo.htmlHello, {{slot id="slot1"/}}
result(if $file == "foo.html"):Hello, Bob
- Static multi slot wrap:
{{insert file="foo.html"}}
{{insert:into slot="slot1"}}Bob{{/insert:into}}
{{insert:into slot="slot2"}}Thorton{{/insert:into}}
{{/insert}}
foo.html
Hello, {{slot id="slot2"/}} {{slot id="slot1"/}}
result:Hello, Thorton Bob
If you are interested, go ahead and try the latest changes in {{macro}} SVN repository.
P.S. By the way, {{include}} and {{wrap}} tags don't really exist anymore, they are just aliases for the {{insert}} tag.
- Simple static include:
- Limb3 2007.4(Frozzy) Released!
-
submitted by pachanga on 31.12.2007 14:25
Happy New Year and Merry Christmas!
It has become a good tradition of the Limb core team to release new packages of Limb3 framework right before the new year, well, this time is not an exception ;)
We are really proud to announce the immediate availability of the Limb3 2007.4(Frozzy) release!
Here's the list of the most notable changes:
- ACTIVE_RECORD package: better error and invalid fields handling using exceptions, support for different names of primary keys added
- CORE package: cruft cleanup, refactoring and misc. code optimizations
- CACHE package: cleanup and better implementation, added initial APC and Memcached support
- DATETIME package: refactoring, renaming lmbDate into lmbDateTime, etc
- MACRO alternative to WACT templating engine added with almost all WACT alike functionality(and even more!)
- IMAGEKIT package: complete redesign using filters and fluent interfaces
- TESTS_RUNNER package: test groups and methods filters, better coverage support
- JS package: upgraded jQuery to 1.2.1
- MAIL package: upgraded phpmailer to 1.73
- WEB_APP package: major cleanup, removed all commands and obsolete controllers
- VIEW package: support for view selection based on template extension added(currently MACRO and WACT)
- TREE package: ArrayAccess and ArrayIterator compatibility fixes
- FS package: more generic iterators added
This is rather a general changelog, see packages for more details.
The bundled release of all packages is available in the SourceForge downloads section of Limb3-2007.4
I'd like to thank syfisher, william, alex433, korchasa, CM-Z, svk, 3d-max, To LST ld й for their numerous contributions. This release wouldn't have been possible without you guys!
Cheers!
- TESTS_RUNNER-0.8.6(beta) Released!
-
submitted by pachanga on 07.11.2007 13:20
We are glad to announce the new release of the TESTS_RUNNER package which ships with limb_unit - a SimpleTest tests "swiss army knife" console based runner.
The CHANGELOG for this release is as follows:
- -- adding test cases filtering by group annotation(TR-18), e.g:
$ limb_unit --groups=db,auth sometest.php
- -- adding test methods filtering(TR-20), e.g:
$ limb_unit --methods=testFoo,testBar sometest.php
- -- lmbTestOptions added, it will be used as a global container for all options
- -- better configuration file(passed with -c option) invalid syntax checking
- -- fixing coverage summary output without generating html reports
This release introduces some unique features which can be quite useful for large sets of tests. They are test class annotation groups selectors and test methods filtering.
Annotation groups selector allows you to execute only those test cases which have some specific @group annotation tags. For example, running the following command:
$ limb_unit -G db,auth test1.php test2.php
...will yield executing only those test cases from test1.php and test2.php files which have @group annotation tag matching "db,auth" filter, e.g:/**
* group db
*/
class MyTest1 extends UnitTestCase
...
/**
* group auth,db
*/
class MyTest2 extends UnitTestCase
...Test methods filtering allows to run only those test methods which match the passed filter. For example, the following command:
$ limb_unit -M testFoo,testBar test.php
..will execute only testFoo and testBar methods omitting the rest ones found in all test cases in test.php file.TESTS_RUNNER package can be installed via Limb pear channel using the shell commands below:
# pear channel-discover pear.limb-project.com
Update: Just a couple of days after this post TESTS_RUNNER-0.8.7(beta) was released. It features new test class filter that allows you to run only those test classes that match this filter, e.g:
# pear install limb/tests_runner-beta$ limb_unit -T FooTest,BarTest alltests.php
- -- adding test cases filtering by group annotation(TR-18), e.g:
- New site section: projects.limb-project.com
-
submitted by pachanga on 24.07.2007 17:25
Hi!
We have introduced new site section - projects.limb-project.com.
This new section will contain not just examples but Limb3 based applications and tools as well. All previous examples from examples.limb-project.com were moved here too.
The first candidates listed in this new section are Syncman, Buildman applications and limb_unit testing utility. And we believe there will be more Limb3 based projects coming quite soon.
Old examples section is now considered to be obsolete, however it will be accessible for a while.
- Syncman and Buildman applications gone public
-
submitted by pachanga on 23.07.2007 17:30
Hi, folks!
We have made two Limb3 based applications Syncman and Buildman available to the public.
Syncman is an application which simplifies projects remote deployment and synchronization by providing both nice web UI(great for managers and other non-technical personnel) and basic shell interface.
Features:
- Nice web UI for non-technical personnel
- Simple file based projects configuration
- Public keys infrastructure for secure passwordless authentication
- Efficient rsync based synchronization(but not limited to rsync)
- Subversion integration
- Pre- and Post-syncing hooks support
- Shell based interface
Buildman is a simple tool which helps to easily establish a Continuous Integration process for your applications.
Features:
- Simple file based configuration for CI projects(no XML)
- Shell based build process invocation
- Build errors mail notifications
- Subversion repository support
- Customizable layout templates
Both applications are in alpha state and there are no file releases yet. You can download the source code for both applications only via svn. However we have been using these applications for quite some time and they proved to be quite useful and stable.
If you have any interest in contributing to any of these projects we'll gladly accept any help, suggestions, patches, etc.
- Limb3 Skeleton, CRUD, Shop applications on SF!
-
submitted by pachanga on 19.07.2007 17:40
Limb3 Skeleton, CRUD and Shop applications are now released on SourceForge as separate packages. Check out Limb3 SourceForge file releases section!
In a nutshell, these applications are:
- Skeleton - empty Limb3 based application which can be used as a skeleton or a playground
- CRUD - a very basic Limb3 based application(now using SQLite database by default)
- Shop - simple e-shop based on Limb3(using SQLite by default as well)
CRUD and Shop applications have been available in the examples section for quite some time while the Skeleton application is released for the very first time.

