PHPackages                             parable-php/framework - 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. parable-php/framework

ActiveLibrary[Framework](/categories/framework)

parable-php/framework
=====================

Parable PHP Framework is a minimalist framework

2.0.6(4mo ago)111264MITPHPPHP &gt;=8.0CI failing

Since Mar 12Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/parable-php/framework)[ Packagist](https://packagist.org/packages/parable-php/framework)[ Docs](https://github.com/parable-php/framework)[ RSS](/packages/parable-php-framework/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (9)Versions (8)Used By (0)

Parable PHP Framework
=====================

[](#parable-php-framework)

[![Workflow Status](https://github.com/parable-php/framework/workflows/Tests/badge.svg)](https://github.com/parable-php/framework/actions?query=workflow%3ATests)[![Latest Stable Version](https://camo.githubusercontent.com/176c6110d9405b4723840e6df9576087d376797caa3cbf43725f9f624edc97da/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f6672616d65776f726b2f762f737461626c65)](https://packagist.org/packages/parable-php/framework)[![Latest Unstable Version](https://camo.githubusercontent.com/5c5aeb74f6ec5e4200e039f67d02ae0589e49291daa41caaf6b75d457b7214b0/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f6672616d65776f726b2f762f756e737461626c65)](https://packagist.org/packages/parable-php/framework)[![License](https://camo.githubusercontent.com/63efee75ada874810899b9fac245b9beded23a3b24877aaba638aea68a2cb43b/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f6672616d65776f726b2f6c6963656e7365)](https://packagist.org/packages/parable-php/framework)

Parable is a PHP framework with two goals: it's just enough, and it doesn't enforce a way to build.

Install
-------

[](#install)

Php 8.0+ and [composer](https://getcomposer.org) are required.

```
$ composer require parable-php/framework
```

And to set up parable, run the following and follow the interactive questions:

```
$ vendor/bin/parable install
```

Usage
-----

[](#usage)

After installation (and you chose to install the example app) you'll have an example application to look at.

Parable 2.0 is based around plugins to arrange everything. It's not a framework that makes you do things a certain way outside of this.

If you want to set up routes? `RoutesPlugin`. Set up the configuration? `ConfigPlugin`. As long as you add these to `Boot.php` they'll be loaded at the appropriate time.

`Application::PLUGIN_BEFORE_BOOT` should contain plugins that need to be loaded *before* the database or sessions are loaded. `ConfigPlugin`, for example, should be here so you can set up the database. `Application::PLUGIN_AFTER_BOOT` is for plugins that require a database, for example.

Example `ConfigPlugin`
----------------------

[](#example-configplugin)

Anything within the config namespace `parable` is used by the `Application` class to set up specific things. You don't have to use these (this example file shows all possible values) but you can if it's faster/easier.

In the example below, `yourstuff` is just an example of adding your own config values to the `Config` instance used throughout the application. Feel free to add whatever you want here!

```
class ConfigPlugin implements PluginInterface
{
    public function __construct(
        protected Config $config
    ) {}

    public function run(): void
    {
        $this->config->setMany([
            'parable' => [
                'default-timezone' => 'Europe/Amsterdam',
                'database' => [
                    'type' => Database::TYPE_MYSQL,
                    'host' => 'localhost',
                    'username' => 'username',
                    'password' => 'password',
                    'database' => 'database',
                    'charSet' => 'utf8mb4',
                    'port' => 40673,
                    // all other values, see https://github.com/parable-php/orm/blob/master/README.md for more
                ],
                'session' => [
                    'enabled' => true,
                    'name' => 'app_session_name',
                ],
                'debug' => [
                    'enabled' => (bool)getenv('DEBUG_ENABLED'),
                    'levels' => E_ALL | ~E_DEPRECATED,
                ],
            ],
            'yourstuff' => [
                'extensions' => [
                    CleanerExtension::class,
                ],
            ],
        ]);
    }
}
```

Example `RoutingPlugin`
-----------------------

[](#example-routingplugin)

To set up routing, just add a `RoutingPlugin` and place it either in `PLUGIN_BEFORE_BOOT` or `PLUGIN_AFTER_BOOT` depending on whether you need the session/database to be active first.

For full information on `parable-php/routing`, read the [README.md](https://github.com/parable-php/routing) of that package.

```
class RoutingPlugin implements PluginInterface
{
    public function __construct(
        protected Router $router,
        protected Path $path
    ) {}

    public function run(): void
    {
        $this->router->add(
            ['GET'],
            'site-index',
            '/',
            [SiteController::class, 'indexAction'],
            ['template' => $this->path->getPath('src/Templates/Site/index.phtml')]
        );
    }
}
```

Being able to set `template` is something specific to Parable 2.0.0, `parable-php/routing` by default doesn't understand templates, so it's being passed as metadata, and the framework itself can deal with the `template` metadata.

The template files are expected to just be `php` files (but named `phtml` here to indicate it's a template). See `welcome.phtml` in the example app to see how to use it.

By setting this at the top of the file, you get access to a lot of built-in features:

```
/** @var \Parable\Framework\Http\Template $this */
```

See the top-most doc-block of `Template.php` to see what's available, but you can do anything from accessing the Di Container (`$this->container`) to events (`$this-events`).

A question I've gotten regularly is 'how do I pass data from a controller to a template/view?'.

Well, my dear friend, it's easy. In the controller:

```
public function __construct(protected DataCollection $dataCollection) {}

public function someAction() {
    $this->dataCollection->set('viewData', [
        'value' => 'this is value',
        'bool' => true,
    ]);
}
```

And in the template, if you've added `@var \Parable\Framework\Http\Template $this` like I suggested you do? Easy!

```
echo 'Value is ' . $this->data->get('viewData.value');
```

The `DataCollection` from `parable-php/getset` is specifically intended for free-form data storing and sharing across files, so it's perfect for this.

Note that you don't need either controllers OR templates! You can also just pass an anonymous function in, which can be perfect for small and simple REST APIs:

```
$this->router->add(
    ['GET'],
    'api-index',
    '/api',
    static function () {
        echo json_encode([
            'status' => 'success',
        ]);
    },
);
```

Packages used in `parable-php/framework`
----------------------------------------

[](#packages-used-in-parable-phpframework)

Check the below packages for any questions you might have about how to approach them. Their behavior is fully available to you as part of the framework and Parable 2.0 doesn't do anything special to stop you or wrap it in weird ways. Mostly what's been added only serves to do setup as part of the `Config` flow, none of which is required.

- [parable-php/console](https://github.com/parable-php/console)
- [parable-php/di](https://github.com/parable-php/di)
- [parable-php/event](https://github.com/parable-php/event)
- [parable-php/getset](https://github.com/parable-php/getset)
- [parable-php/orm](https://github.com/parable-php/orm)
- [parable-php/routing](https://github.com/parable-php/routing)
- [parable-php/http](https://github.com/parable-php/http)

Thank youses
------------

[](#thank-youses)

I want to thank the following people for inspiring, challenging and brainstorming with me about ideas and how to make Parable the best framework I never found anywhere else:

- [Dave van der Brugge](https://github.com/dmvdbrugge) for his almost insane eye for detail and asking 'why?' so often it made me cry once.
- [Thijs Riezebeek](https://github.com/Thijs-Riezebeek) for being my braining sparring partner whether he wants to or not. Will never ever ever not challenge me on *every single decision ever*. Which is good!
- [Jerry van Kooten](https://github.com/jerry1970) for always going well beyond the knowledge I'd expect him to have and testing my stuff out. Also for actually creating PRs when he hated something, improving a few packages massively.
- [Lucas Grossi](https://github.com/lgrossi) for choosing to go with Parable's alpha version for an actual professional project, forcing me to release 2.0.0 because otherwise it'd never be approved.

Contributing
------------

[](#contributing)

Any suggestions, bug reports or general feedback is welcome. Use github issues and pull requests, or find me over at [devvoh.com](https://devvoh.com).

License
-------

[](#license)

All Parable components are open-source software, licensed under the MIT license.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance74

Regular maintenance activity

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~292 days

Recently: every ~438 days

Total

7

Last Release

139d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7db40df70c77a9d591de4521642b0ddcb6c448e4876b22dc2f76900c736ab579?d=identicon)[robindevoh](/maintainers/robindevoh)

---

Top Contributors

[![devvoh](https://avatars.githubusercontent.com/u/7500415?v=4)](https://github.com/devvoh "devvoh (2 commits)")[![lgrossi](https://avatars.githubusercontent.com/u/34237492?v=4)](https://github.com/lgrossi "lgrossi (1 commits)")

---

Tags

frameworkmicroprototypingminimalparable

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/parable-php-framework/health.svg)

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

###  Alternatives

[slim/slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

12.3k49.9M1.3k](/packages/slim-slim)[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

41.5k328.9k1](/packages/ccxt-ccxt)[phprest/phprest

PHP Rest Framework.

3049.3k](/packages/phprest-phprest)

PHPackages © 2026

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