PHPackages                             dragonmantank/casket - 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. dragonmantank/casket

ActiveProject

dragonmantank/casket
====================

A compact PHP Object Relational Management library

2111PHP

Since Nov 27Pushed 11y ago1 watchersCompare

[ Source](https://github.com/dragonmantank/casket)[ Packagist](https://packagist.org/packages/dragonmantank/casket)[ RSS](/packages/dragonmantank-casket/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Casket
======

[](#casket)

Last Updated: 2014-05-02, Chris Tankersley

[![Build Status](https://camo.githubusercontent.com/b387b24d5866c39c7df86f64e659953be8477e98d7515a70779ba1eaabc4fe2d/68747470733a2f2f7472617669732d63692e6f72672f647261676f6e6d616e74616e6b2f6361736b65742e737667)](https://travis-ci.org/dragonmantank/casket)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1a600889bb03cc62c0719a3e1039789dfd7847761069461048c1cedb673f19d8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f647261676f6e6d616e74616e6b2f6361736b65742f6261646765732f7175616c6974792d73636f72652e706e673f733d39646535316163616566633733326666303238356137383563373732623538653961643633653632)](https://scrutinizer-ci.com/g/dragonmantank/casket/)

Casket is a compact Object Relational Management library for PHP. It allows for quick prototyping and management of objects that need to be persisted. Casket is a fork of PhpORM, an older ORM I created. You can find it at

Since persistence doesn't always mean to a database, it can easily be extended to support different persistance layers.

This version uses Aura.SQL to provide support for any database provider supported by Aura.SQL. All you need is PDO!

Parts of Casket
---------------

[](#parts-of-casket)

- Entities - Singular Objects
- Repositories - Allows searching and retrieving
- Storage - Ways to access different data stores

### Entities

[](#entities)

Entities are the 'things' in the application. If you are building a pet website, Entities would be something like a 'Animal', 'AdoptionAgency', 'Address'. Entities are a single object that needs to be persisted, more normally in a database.

An Entity would look like this:

```
Class Animal
{
    public $id;           // Database ID
    public $type;         // Type of animal
    public $inductionDate // Date Animal came to Shelter
    public $name;         // Name of the animal
    public $shelter_id    // Foreign key of the animal shelter
}

```

You could then access the entity like this:

```
$animal = new Animal();
$animal->type = 'Cat';
$animal->inductionDate = time();
$animalRepository->save($animal);

```

### Repositories

[](#repositories)

Repositories are the recommended way to get information out of the data storage. We've done away with the need for using direct Data Access Objects. Repositories are generally set around a specific Entity and work only with that Entity. This allows the Repository to automatically generate Entities based on the data sources.

For database-backed persistance, a basic repository needs no specific class and can utilize the shipped DBRepository class. It requires just a storage mechanism and a prototype object to base it's results on.

```
// $storage is a pre-created connection to your data store, see the Storage section
$animalRepo = new Casket\Repository\DBRepository($storage, new Animal());

```

This repository will return Animal entities (or collections of Animal entities):

```
$cats = $animalRepo->fetchAllBy(array('type' => 'cat'));  // Return all the cats
$dog = $repo->find($dogId); // Find the specified object by primary key
$fluffy = $repo->findBy(array('name' => 'Fluffy')); // Search by something other than primary key

```

### Storage

[](#storage)

Storage systems provide a standard way to interact with some sort of storage system, be it a database or an API. Casket ships with a PDO-based storage system that utilizes Aura.SQL and Aura.SQL-Query to provide access to many different database backends.

For the AuraExtendedPdo storage system, you just need to invoke it with an AuraExtendedPdo object and a QueryFactory from Aura.SQL-Query.

```
$storage = new Casket\Storage\AuraExtendedPdo($extendedPdo, new Aura\SqlQuery\QueryFactory('mysql'));

```

You can then use the storage with your Repositories so they can access data:

```
$animalRepo = new Casket\Repository\DBRepository($storage, new Animal());

```

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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/8c2583b67d4e1a4ade23b6ce271980d18bf3facb4ea3f0610fded770f380d17d?d=identicon)[dragonmantank](/maintainers/dragonmantank)

---

Top Contributors

[![dragonmantank](https://avatars.githubusercontent.com/u/108948?v=4)](https://github.com/dragonmantank "dragonmantank (5 commits)")[![harikt](https://avatars.githubusercontent.com/u/120454?v=4)](https://github.com/harikt "harikt (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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