PHPackages                             bento/bento - 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. bento/bento

ActiveLibrary[Framework](/categories/framework)

bento/bento
===========

Simple micro-framework

0.6.4(11y ago)331443MITPHPPHP &gt;=5.3.0

Since Oct 29Pushed 6y ago7 watchersCompare

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

READMEChangelogDependenciesVersions (23)Used By (0)

Bento - A simple PHP micro framework
====================================

[](#bento---a-simple-php-micro-framework)

Bento provides a simple yet flexible routing system, built-in CSRF prevention, flash session variables, and numerous little helper functions to make developing web apps enjoyable.

Installation
------------

[](#installation)

Bento is self contained; it consists of a single PHP file. Simply copy the file into your lib or vendor directory, require it from your front controller script, and you're all set. The alternative is through [composer](http://getcomposer.org/); the minimum composer.json configuration is:

```
{
    "require": {
        "bento/bento": "@stable"
    }
}

```

PHP 5.3 or newer is required. PHP 5.4 or newer is strongly recommended.

### Apache

[](#apache)

Minimum .htaccess configuration for mod\_rewrite:

```

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

```

Or, if you are not uploading to the root of your site:

```

    RewriteEngine On

    # append %{ENV:REWRITE_BASE} to rules.
    RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
    RewriteRule ^(.*)$ - [E=REWRITE_BASE:%1]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ %{ENV:REWRITE_BASE}index.php [L]

```

### Nginx + PHP-FPM

[](#nginx--php-fpm)

Minimum nginx configuration:

```
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

```

If you want to install your application in a subdirectory, for example `myapp`, do the following:

```
location /myapp {
    try_files $uri $uri/ /myapp/index.php?$query_string;
}

```

### Built-in server

[](#built-in-server)

To use the built-in server available in PHP 5.4, invoke the following command from your terminal:

```
> php -S localhost:8000 index.php

```

Adjust the host and port as necessary. Replace all instances of index.php above with your front controller file.

Example Application
-------------------

[](#example-application)

There is a simple blog application found in `examples/blog` that shows off all the major features and usage of Bento. Refer to its `README.md` for more info.

Usage
-----

[](#usage)

The canonical "Hello, World!" example:

```
