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

ActiveLibrary[Framework](/categories/framework)

hooch/hooch
===========

A minimalist web framework for PHP 5

5121PHP

Since Aug 10Pushed 13y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

HOOCH
=====

[](#hooch)

I whipped this up for a couple of small projects outside of work and now I'm giving it to the internet.

It's a simple microframework that lets PHP do the things it does well, which depending on the day and the person you ask, either is or isn't much.

Hooch requires Twig, a templating engine very similar to Jinja2 and Django templates.

Usage:

```
// Use the Composer autoloader.
require('vendor/autoload.php');

// Instantiate the App class. Provide the base relative URL.
// For example, if it's http://127.0.0.1/~test/, use '/~test'
$app = new \Hooch\App('/~test');

// You can still access the Twig context.
$app->twig->addGlobal('test', 1);
// But the app, basePath, these are all available already.

// Use a Preprocessor to implement authentication, etc.
// This is a bad example, but you get it. You're smart.
class AuthProcessor extends \Hooch\Preprocessor {
    public function test($app, $path) {
        global $authenticated;
        return $authenticated;
    }
}
// If you're not using a preprocessor, omit this line.
$app->preprocess(new AuthProcessor());

// Handle the home page. True anonymous functions require
// PHP 5.3.0 and above.

$app->get('/', function($args) use ($app) {
    return $app->render('home.html', array('someVal' => true));
});
// Look, even PHP can have moustaches!

// If you're on an older version of PHP:
function second_page($args) {
    global $app;
    return $app->render('second_page.html');
}

// $args will be: array('name' => :name)
// The last argument after the callback to any route is the route name,
// which can be used to automatically build URLs.
$app->get('/person/:name', second_page, 'second_page');

// Handle POST requests
// Here's an example of a redirect as well.
$app->post('/save', function ($args) use ($app) {
    // Use this to automatically stripslashes.
    // You don't have to!
    $form = $app->getPost();

    if (isset($form['name'])) {
        // Requires the route name, which you defined above.
        $app->seeother('person', array('name' => $form['name']));
    } else {
        // Throw a 404.
        $app->notFound();
    }
});

// Need to return some JSON for an AJAX call?
$app->post('/saveAJAX', function ($args) use ($app) {
    return $app->apiSimple(function() use ($args) {
        return array(
            'test' => 1,
            'another-test' => 2
            );
    });
}, 'save_ajax');

// Need to dynamically reference URLs, like Flask?
$app->get('/anotherpath/:user_id', function ($args) use ($app) {
    return 'test';
}, 'named_path');

/*
    In your template, you can reference it via the urlFor method:

    {{ app.urlFor('named_path', {'user_id': 1}) }}
*/

// Or, in PHP:
print $app->urlFor('named_path', array('user_id' => 1));

// Finally, if you just need to render a template without any extra
// variables:
$app->tGet('/top10', 'top10.html', 'top10');

// And the thing that makes it all happen:
$app->serve();

```

You'll also need an .htaccess to redirect everything to your index.php file. This one works:

```
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2b08b3c540a70fb31fb1142a56c7988b5fbddd0f0f96a6bdd84b82f5ad1739e?d=identicon)[lysol](/maintainers/lysol)

---

Top Contributors

[![lysol](https://avatars.githubusercontent.com/u/55573?v=4)](https://github.com/lysol "lysol (24 commits)")[![neckro](https://avatars.githubusercontent.com/u/897054?v=4)](https://github.com/neckro "neckro (1 commits)")

### Embed Badge

![Health badge](/badges/hooch-hooch/health.svg)

```
[![Health](https://phpackages.com/badges/hooch-hooch/health.svg)](https://phpackages.com/packages/hooch-hooch)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
