PHPackages                             davidyell/statusable - 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. [Database &amp; ORM](/categories/database)
4. /
5. davidyell/statusable

Abandoned → [muffin/trash](/?search=muffin%2Ftrash)ArchivedCakephp-plugin[Database &amp; ORM](/categories/database)

davidyell/statusable
====================

A behaviour to allow model records to have various statuses

v0.2.1(11y ago)5451MITPHP

Since May 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/davidyell/CakePHP-Statusable)[ Packagist](https://packagist.org/packages/davidyell/statusable)[ RSS](/packages/davidyell-statusable/feed)WikiDiscussions master Synced 2w ago

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

CakePHP-Statusable
==================

[](#cakephp-statusable)

A [CakePHP](http://www.cakephp.org/) plugin which will take out the hassle of managing the status of items in a web application. I am always adding a `Status` model and `status_id` fields to my models so that I can mark them as active or inactive.

End of life
-----------

[](#end-of-life)

This plugin has now reached end of life, and no further updates will be made. If you are looking for a CakePHP 3 plugin with similar functionality, please see the [UseMuffin/Trash](https://github.com/usemuffin/trash) plugin.

What does it do?
----------------

[](#what-does-it-do)

The behaviour, when attached to a model, will deal with the filtering of finds automatically so that items which have specific statuses will not be displayed to users. It will also allow soft deletion by just changing the status of a record to 'deleted' rather than removing it.

There is also a method to allow you to pull a list of statuses from the behaviour to display in your admin for users to change the status of a record.

Assumptions
-----------

[](#assumptions)

This plugin makes just one simple assumptions about your application.
**You have an admin area to administer content, probably using the `admin` prefix**
This assumption is because you will want to display some items to front-end users and some different items to the administrator users. The switching will work based on the routing prefix.

Configuration
-------------

[](#configuration)

You need to load the plugin in your `app/Config/bootstrap.php` using `CakePlugin::load('Statusable')`. You can use `CakePlugin::loadAll()` but it's slow.

### Database

[](#database)

You will also need a table to store your statuses. You can create the default using the following.

```
$ Console/cake schema create -p Statusable
```

Once the table is created, you'll need to populate it with some statuses for the behaviour to use. An example might be,

```
INSERT INTO `statuses` (name, created, modified) VALUES
('Live', NOW(), NOW()),
('Inactive', NOW(), NOW()),
('Protected live', NOW(), NOW()),
('Protected inactive', NOW(), NOW()),
('Archived', NOW(), NOW()),
('Deleted', NOW(), NOW())
```

You'll need to create the fields for the `status_id` and also the `deleted_date` in your database tables, for each model to which you attach the behaviour. You can name these differently if you want to but you'll have to remember to configure them when you attach the behaviour to the model.
Don't forget to set the `status_id` fields default value to your default status. For example `2` for `inactive`.
Also the `deleted_date` field will need to be a `DATETIME` field.

### Attach the behaviour to your model

[](#attach-the-behaviour-to-your-model)

```
// Model/Example.php
    public $actsAs = array(
        'Statusable.Statusable' // If you want to configure the behaviour you can pass options in here
    );
```

Configuration options can be passed to the behaviour here if your configuration differs from the default. You can find the default options in the behaviour source code in `$defaults`.

### Add component to controller

[](#add-component-to-controller)

In your controller, you'll need to add the component. I'm hoping to be able to get rid of this at some point, but for the meantime, it's needed to get at the routing.

```
// Controller/ExampleController.php
    public $components = array(
        'Statusable.Statusable'
    );
```

Load statuses in views
----------------------

[](#load-statuses-in-views)

If you want to add a `status_id` field to your `add` and `edit` actions, the behaviour has a handy method to return a list of statuses.

```
// Controller/ExampleController.php
$statuses = $this->Example->getStatuses();

// View/Example/edit.ctp
echo $this->Form->input('status_id');
```

Proposed features
-----------------

[](#proposed-features)

- Migration for schema of `statuses` table
- `Status` model
- Behaviour using model callbacks to change statuses
- Behaviour to modify finds to add the extra conditions
- Borrrow some functionality from the CakeDC/Utils/SoftDelete behaviour in relation to deletion
- Something to speed up administration of records, like a component which injects a `status_id` field into forms. Might be too much and too narrow a use-case to be helpfull to everyone though.
- Not too sure on having the statuses in the database or in the behaviour. If they are in the database how will you know which ones are displayable and where? **Allowed configuration in the behaviour**

Honourable mentions
-------------------

[](#honourable-mentions)

I also make use of the [CakeDC/Utils/SoftDelete](https://github.com/CakeDC/utils/blob/master/Model/Behavior/SoftDeleteBehavior.php) behaviour on a regular basis, so this takes inspiration from there. So a generous tip of the hat to the [CakeDC](http://github.com/cakedc) guys.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

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 ~73 days

Total

3

Last Release

4284d ago

Major Versions

v0.2.0 → 2.x-dev2014-10-07

### Community

Maintainers

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

---

Top Contributors

[![davidyell](https://avatars.githubusercontent.com/u/49889?v=4)](https://github.com/davidyell "davidyell (22 commits)")

### Embed Badge

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

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

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.3k10](/packages/helsingborg-stad-municipio)[stuttter/ludicrousdb

LudicrousDB is a database class that supports replication, failover, load balancing, &amp; partitioning, based on Automattic's HyperDB drop-in.

564125.1k](/packages/stuttter-ludicrousdb)[aaemnnosttv/wp-sqlite-db

SQLite drop-in database driver for WordPress

58465.3k5](/packages/aaemnnosttv-wp-sqlite-db)[andreyryabin/sprint.migration

bitrix migration module

207204.1k2](/packages/andreyryabin-sprintmigration)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[humanmade/ludicrousdb

LudicrousDB is a database class that supports replication, failover, load balancing, &amp; partitioning, based on Automattic's HyperDB drop-in.

13215.8k7](/packages/humanmade-ludicrousdb)

PHPackages © 2026

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