Limb PHP Framework

What is Limb?

Limb is an OpenSource(LGPL) Library of Interdependent Modules and Blocks mostly aimed for rapid web application prototyping and development with PHP5. The current actively developed branch is Limb3(there is also Limb2 but it's not maintained anymore).

Limb3 consists of many reusable components and you can cherry pick the ones 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 decorator generators, transparent object proxies, etc)
  • toolkit: dependency injection tools
  • macro: a powerful and highly customizable templating system which uses macro-alike 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
  • and many others...

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

Disabling PEAR channel
submitted by admin on 29.04.2009 00:00

Due to the lack of human resources we have decided to shut down Limb3 PEAR channel for now. From now on Limb3 will only be released as an archived bundle of all packets on SourceForge.

There are several reasons behind this decision:

  • Unfortunately we don't have a permanent maintainer of the PEAR channel responsible for resolving misc. technical issues
  • As the practice has shown nobody actually used it in the past
  • In our humble opinion, PEAR channels is quite an immature feature not widely supported. For example, there is only one official tutorial(written back in 2006) on how to setup the channel which doesn't work out of the box.
  • Making a release on a PEAR channel is quite a major pain and a maintenance burden. It's much easier to bundle all packets into one archive and release it on the SourceForge.

Good bye PEAR for the time being...

5 years online
submitted by admin on 26.04.2009 00:00

It has been 5 years since the very first news post on this site. Here is how it all started:

06/04/2004 We're online! After several weeks of hard working we've finally managed to get LIMB support site on-line...(Phew! Let's go, guys, grab some beer! )

(it's been 5 years and 2 weeks actually but it doesn't matter very much :) )

The team that started this project consisted of pacha(later renamed into pachanga), serega, william and dbrain. Here is our pictures which were made about 4 years ago when we got the second place in ZendContest: http://old.limb-project.com/root/news/125

Today the team is much bigger and I'd like to name those who take care of Limb. Mostly they are employees of the BIT Creative company for whom this project is a job and(I really hope so!) a hobby.

The core team:

  • pachanga - Pavel Shevaev
  • serega(aka syfisher) - Sergey Yudin
  • wiliam - Ilia Moltyaninov
  • korchasa - Stanislav Korchagin
  • vasiatka - Alexey Vasin
  • hidrarg - Alexey Loginov
  • momental - Vitaliy Saushev
  • slevin - Roman Kitaev
  • knevcher - Andrey Knyazev
  • hawk - Andrey Yastrebov
  • fly - Mikhail Zubkov
  • step - Anton Petryshev

Active contributors(sorry folks, I don't know names the most of you):

  • alex433
  • Forumsky
  • conf
  • __Alex
  • CM-Z
  • svk
  • idler
  • lifer
  • 3d-max

(sorry if I missed someone!)

Folks, thank you all for your commitment and participation in this project! Let's hope the next 5 years will be as productive and fun as those passed :)

New packets staging area - incubator
submitted by pachanga on 27.11.2008 08:30

After short discussions it was decided(thanks to korchasa) to create a special Limb3 repository staging section - incubator. The main idea behind it is to place all new experimental packages there for some "incubation period" before they shape up and get stable a bit and later, if everyone agrees, move them into the trunk. This should remove all the bureaucracy involved with committing new stuff into trunk thus allowing experimental packages' authors to implement any crazy ideas they have on their mind.

Currently there are two new packages in the incubator:

  • bundle - PHP code bundler which speeds up loading of large libraries by putting all code into one script
  • cache2 - new improved implementation of the existing cache package

It's pretty simple to use(on your own risk, of course) incubator packages in your projects:

  • Checkout incubator stuff from svn:
 svn co https://svn.limb-project.com/limb/3.x/incubator path/to/incubator 
  • Add path to incubator into your PHP include path using the following code in your scripts:
 set_include_path("path/to/incubator" . PATH_SEPARATOR . get_include_path()); 
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 packages

In 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.id
Eager 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.html
    Bob

    result:
    Hello, Bob
  • Simple dynamic include:
    Hello, {{insert file="$file"/}}
    foo.html
    Bob

    result(if $file == "foo.html"):
    Hello, Bob
  • Simple static wrap:
    {{insert into="slot1" file="foo.html"}}Bob{{/insert}}

    foo.html
    Hello, {{slot id="slot1"/}}

    result:
    Hello, Bob
  • Simple dynamic wrap:
    {{insert into="slot1" file="$file"}}Bob{{/insert}}

    foo.html
    Hello, {{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.

Limb3 2007.4(Frozzy) Released!
submitted by admin on 31.12.2007 00:00

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 
# pear install limb/tests_runner-beta


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:
$ limb_unit -T FooTest,BarTest alltests.php
 
[ View Archive ]
Copyright © 2003-2009 BIT Бюро Информационных Технологий (ООО БИТ). Создание сайтов на собственной платформе Limb. Мультимедиа презентации. Дизайн.