PHPackages                             jamierumbelow/presenters - 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. jamierumbelow/presenters

ActiveLibrary

jamierumbelow/presenters
========================

Clean up your views with PHP presenters

1.0.0(13y ago)520.8k2MITPHPPHP &gt;=5.3.2

Since Dec 4Pushed 13y ago2 watchersCompare

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

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

PHP Presenters
==============

[](#php-presenters)

It's very easy to end up with complicated, brittle views full of messy logic and presentation code that really should be somewhere else. In my book, [The CodeIgniter Handbook - Volume One - Who Needs Ruby?](https://efendibooks.com/books/codeigniter-handbook/vol-1) I discuss a great technique for cleaning up your views.

This small library is a lightweight, tested solution for using presenters within PHP (and CodeIgniter apps). **This library is tailored for CI, but works with any PHP application.**

Synopsis
--------

[](#synopsis)

```
class Book_Presenter extends Presenter
{
	public function price()
	{
		return number_format($this->book->price, 2);
	}
}

$book = $this->db->where('id', 1)->get('books')->row();
$book = new Book_Presenter($book);

echo $book->title() . ' costs ' . $book->price();

```

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

[](#installation)

Add it to your **composer.json**:

```
{
	"require": {
		"jamierumbelow/presenters": "*"
	}
}

```

Run `composer update`:

```
$ php composer.phar update

```

...and autoload:

```
require_once 'vendor/autoload.php';

```

Usage
-----

[](#usage)

Create a new class with the suffix `_Presenter`. `Book_presenter` will create a `$this->book` variable, `Game_Type_Presenter` will create a `$this->game_type` variable.

Instantiate a new presenter object and pass through the raw object:

```
$book = $this->db->where('id', 1)->get('books')->row();
$book = new Book_Presenter($book);

```

You can then access the data inside the presenter:

```
class Book_Presenter extends Presenter
{
	public function title()
	{
		return $this->book->title . ' - ' . $this->book->subtitle;
	}
}

```

If you'd like to customise the object name, pass it through as the second parameter:

```
$book = new Book_Presenter($book, 'bookObject');

class Book_Presenter extends Presenter
{
	public function title()
	{
		return $this->bookObject->title . ' - ' . $this->bookObject->subtitle;
	}
}

```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4913d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/616bb0b51a1193358ed550722f3a22cc32217bad7b9fa7f18cab73fb0760413d?d=identicon)[jamierumbelow](/maintainers/jamierumbelow)

---

Top Contributors

[![jamierumbelow](https://avatars.githubusercontent.com/u/49284?v=4)](https://github.com/jamierumbelow "jamierumbelow (2 commits)")

---

Tags

phpcodeigniterviewspresenterspresentinghandbook

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[phug/phug

Pug (ex-Jade) facade engine for PHP, HTML template engine structured by indentation

67292.2k13](/packages/phug-phug)[nguyenanhung/codeigniter-basic-helper

CodeIgniter - Basic Helper

1027.3k1](/packages/nguyenanhung-codeigniter-basic-helper)

PHPackages © 2026

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