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

ActiveProject[Framework](/categories/framework)

whirlpool/whirlpool
===================

An MVC framework based on Composer components.

0.0.6(10y ago)125PHP

Since Feb 2Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (7)Used By (0)

Whirlpool Framework
===================

[](#whirlpool-framework)

Introduction
------------

[](#introduction)

Whirlpool framework is a lightweight MVC framework based on a few different composer packages.

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

[](#installation)

### Installing the framework

[](#installing-the-framework)

The best way to install the framework is through composer. The following command will install the framework to /new/project/location

```
composer create-project whirlpool/whirlpool /new/project/location

```

### Setting up the environment

[](#setting-up-the-environment)

By default, whirlpool expects all web requests to go to the index.php file in the public directory. I suggest setting the "public" directory as your web/document root.

Getting Started
---------------

[](#getting-started)

### Routing

[](#routing)

By default, routes are located at `application/routes.php`. You can add/remove more route definition locations by looking in `config/routing.php` under `routeFiles`.

```
// If a user comes in on this url: site.com/my-page
// And we want to execute a method in this controller: GeneralController
// With a name of: myPageAction
// We would add the following route definition.
$r->addRoute('GET', '/my-page', 'general@myPage');

```

If no method is specified the default will be used which can be found in `config/routing.php`. For more help with creating routes please see [FastRoute](https://github.com/nikic/FastRoute)

### Controllers

[](#controllers)

Controllers are located at `application/controllers`. Each method that can be an action should be followed by "Action". Each controller should end with the text "Controller" and the file name must match the controller name. A BaseController is provided with Whirlpool and it is recommended that your controllers extend `Whirlpool\BaseController`.

### Models

[](#models)

The models are located at `application/models`. The `Whirlpool\BaseModel` extends Eloquent so extending from it will give you access to all the wonderful things that Eloquent provides. For help with Eloquent see the [documentation](http://laravel.com/docs/4.2/eloquent)

### Autoloading More Directories

[](#autoloading-more-directories)

You are able to specify more directories from which Whirlpool will auto-load from in the config/autoload file. The 'directory' array will add directories for standard requests, and the 'subdomainDirectory' will add directories for requests that come in on a subdomain. For example..

```
return [

    'directories' => [
        '/repositories/',
    ],

    'subdomainDirectories' => [

    ],

];

```

This allows you to create classes in `application/repositories` and have them autoloaded.

### Views

[](#views)

Views are handled with [Twig](http://twig.sensiolabs.org/). When your controller extends from `Whirlpool\BaseController` you will have access to the twig object via `$this->twig`. A shortcut to display views has also been provided in the form of `$this->displayView($viewName [, array $data = array()]);`.

### Database Configuration

[](#database-configuration)

In order to use Models you need to have a database connection. The credentials for this connection can be set in `config/database.php`. An example configuration file can be found at `config/example_database.php`.

### Multiple Databases

[](#multiple-databases)

You can interact with multiple databases in a way that is very similar to Laravel as we are using Eloquent. All you need to do is ensure that the new database credentials have been set up in `config/database.php` with a name of your choosing. You can set the name for that connection by either specifying it in the array key, or setting 'name' =&gt; 'my-second-connection'.

Once the name is set simply open a model and set the connection name.

```
protected $connection = 'my-second-connection';

```

You are also able to do the following, where User is a model.

```
$user = new User();
$user->setConnection('my-second-connection');

```

Subdomains
----------

[](#subdomains)

Subdomains can be a useful way to separate logic for different sections of your applications. You can use `Request::subdomain()` to get the active subdomain. Please note that there is a list of subdomains to ignore in `config/general.php`.

### Get going with subdomains

[](#get-going-with-subdomains)

All you have to do to start using a subdomain is to create a folder in `application/subdomains`. Inside this new folder you will need to create the folders `controllers`, `models` and `views`. This folder will be used as the main application folder when the specified subdomain is active, and the `application/models` folder will act as a fallback.

Hooks
-----

[](#hooks)

### Introduction to hooks

[](#introduction-to-hooks)

There are several hooks that you can manipulate in order to run custom code at a fixed point in the applications life cycle.

Hooks should be created in `config/hooks.php` in the following format:

```
return [
    'hook-name' => function ($argument1, $argument2) {
        // This code will be run when the hook is triggered
    },
];

```

### List of default hooks

[](#list-of-default-hooks)

Hook NameArgumentsTimingwhirlpool-initializedwhirlpoolOnce Whirlpool::init() has been executed.whirlpool-load-actionpathWhen an action is about to be loaded.whirlpool-loaded-actionactionWhen an action has just been loaded.whirlpool-execute-actionactionWhen an action is about to be executed.whirlpool-controller-initializedcontroller, actionWhen the main controller has just been instantiated.whirlpool-executed-actionresponseWhen an action has just been executed.whirlpool-class-not-foundclassWhen the Whirlpool autoloader cannot find a class.### Dependency Injection

[](#dependency-injection)

You can use dependency injection in your classes very easily. Just include a type hint to your class constructor!

```
class SomeObject()
{
    public function output()
    {
        echo "Hello World.";
    }
}
class MyController {
    public function __construct(SomeObject $ob)
    {
        $ob->output();
    }
};
$controller = Whirlpool::make('MyController');

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~76 days

Recently: every ~96 days

Total

6

Last Release

3731d ago

### Community

Maintainers

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

---

Top Contributors

[![TomWright](https://avatars.githubusercontent.com/u/935867?v=4)](https://github.com/TomWright "TomWright (6 commits)")

---

Tags

frameworkmvcwhirlpool

### Embed Badge

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

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

PHPackages © 2026

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