PHPackages                             codecraft63/limonade - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. codecraft63/limonade

ActiveLibrary[Framework](/categories/framework)

codecraft63/limonade
====================

a PHP micro-framework

011PHP

Since May 20Pushed 9y ago2 watchersCompare

[ Source](https://github.com/codecraft63/limonade)[ Packagist](https://packagist.org/packages/codecraft63/limonade)[ RSS](/packages/codecraft63-limonade/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Limonade: README
================

[](#limonade-readme)

Limonade is a PHP micro framework for rapid web development and prototyping.

It's inspired by frameworks like [Sinatra](http://www.sinatrarb.com/) or [Camping](http://github.com/camping/camping) in Ruby, or [Orbit](http://orbit.luaforge.net/) in Lua. It aims to be simple, lightweight and extremly flexible.

Limonade provides functions that complete the PHP basic set, while keeping consistency with native functions and sitting up on them.

Limonade is easy to learn and provides everything that you can expect from a modern framework (MVC, REST, ...)

```
require_once 'lib/limonade.php';
dispatch('/', 'hello');
    function hello()
    {
        return 'Hello world!';
    }
run();

```

About this document
-------------------

[](#about-this-document)

This document provides a quick, but comprehensive, guide of Limonade features.

For more informations, you can see the [website](http://limonade-php.github.com/), [examples](https://github.com/sofadesign/limonade/wiki/Examples-and-tutorials), and of course the [source code](http://github.com/sofadesign/limonade/blob/master/lib/limonade.php) which is still the best documentation.

A [discussion group](http://groups.google.fr/group/limonade) is also available for more exchanges.

Requirements
------------

[](#requirements)

- PHP 5.1.6 &gt; (successfully tested with PHP 5.1.6 but it might work with older versions)

Routes
------

[](#routes)

Routes combine

- an HTTP method
- with an URL matching pattern
- and a callback parameter

So they make the glue between an URL + a HTTP method, and the code provided in a callback controller.

```
dispatch('/', 'my_get_function');
# same as dispatch_get('my_get_function');
    function my_get_function()
    {
        // Show something
        // with the code of this callback controller
    }

dispatch_post('/', 'my_post_function');
    function my_post_function()
    {
        // Create something
    }

dispatch_put('/', 'my_update_function');
    function my_update_function()
    {
        // Update something
    }

dispatch_delete('/', 'my_delete_function');
    function my_delete_function()
    {
        // Delete something
    }

dispatch_patch('/', 'my_patch_function');
    function my_patch_function()
    {
        // Patch something
    }

```

Routes are matched in the order they are declared. The search is performed with a path given through browser URL:

```
http://localhost/my_app/?u=/my/path
http://localhost/my_app/?uri=/my/path
http://localhost/my_app/index.php?/my/path
http://localhost/my_app/?/my/path

```

When `PUT`,`DELETE` or `PATCH` methods are not supported (like in HTML form submision), you can use the `_method` parameter in `POST` requests: it will override the `POST` method.

```
