PHPackages                             enzyme/axiom - 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. enzyme/axiom

ActiveLibrary

enzyme/axiom
============

A set of interfaces &amp; classes for creating domain driven projects.

v4.2.0(10y ago)10501MITPHPPHP &gt;=5.5.0

Since Jan 12Pushed 7y ago2 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (19)Used By (0)

[![](https://cloud.githubusercontent.com/assets/2805249/12291425/e1430a16-ba32-11e5-950e-7887df7a75e9.png)](https://cloud.githubusercontent.com/assets/2805249/12291425/e1430a16-ba32-11e5-950e-7887df7a75e9.png)

[![Build Status](https://camo.githubusercontent.com/3ed97b05e90c0c5fc0390f35eb76b4338245b3b1adcf2f73969c40656b005868/68747470733a2f2f7472617669732d63692e6f72672f656e7a796d652f6178696f6d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/enzyme/axiom)[![Coverage Status](https://camo.githubusercontent.com/199c6fa88df06c2a73931fed4c959b899d9adbf176b02cf59cd60f2b9ab08b83/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f656e7a796d652f6178696f6d2f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/enzyme/axiom?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ac498e5ddc7950040b4b8773d2da8e3f8b2eee5a5644ba6f48f1c2fb4877eba7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656e7a796d652f6178696f6d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/enzyme/axiom/?branch=master)

Axiom is a collection of PHP PSR-2 compliant interfaces and classes designed to help you flesh out domain driven projects. Sticking to a framework like Axiom will help keep all your projects consistent in their layout, design and implementation, hopefully making your job (and others working on your code) easier.

Installation
============

[](#installation)

```
composer require enzyme/axiom
```

What's included
===============

[](#whats-included)

#### Atoms

[](#atoms)

Atoms are wrappers around native php variable types such as int and string. They are used when a service or class expects one of these values and doesn't want to litter the code with type checks such as `if (is_string($var)) {...}`.

#### Bags

[](#bags)

Bags are used to carry data around the system, whether from the user, an API or an external service.

#### Exceptions

[](#exceptions)

These exceptions are thrown by the collection of concrete classes included when internal errors occur.

#### Factories

[](#factories)

A factory is responsible for the creation and modification of models. It has intimate knowledge of how a model is built and the various attributes it acquires.

#### Models

[](#models)

Models represent objects in your domain. They are unique, have a set of attributes and are the primary resource of your application.

#### Recipients

[](#recipients)

Recipients are parts of your system that require knowledge of when a model is either successfully or unsuccessfully created, updated or destroyed after they have initiated a command.

#### Reports

[](#reports)

Reports are containers that carry a message and optional details associated with the outcome of some event or action in your domain. For example, when a model failed to be created, a FailureReport can be returned with the details of what went wrong.

#### Repositories

[](#repositories)

Repositories are model collections that allow the system to store and retrieve models from an underlying persistence layer.

Concrete classes
================

[](#concrete-classes)

There are a couple concrete classes included with Axiom that you can use straight out of the box. These are:

#### Atoms

[](#atoms-1)

- IntegerAtom - represents an integer value. This does not include floats.
- StringAtom - represents a string, either empty or of any size.

#### Bags

[](#bags-1)

- ArrayBag - simply stores a collection of key/value pairs using an internal native array.

#### Reports

[](#reports-1)

- SimpleReport - provides a basic report implementation that stores a message and optional details.
- FailureReport - extends the simple report and is purely a more readable means of reporting a failure.

#### Repositories

[](#repositories-1)

- InMemoryRepository - stores a collection of models in-memory using a simple array.

Generators
==========

[](#generators)

Axiom comes with a set of command line generators for quickly creating skeleton implementations of the various interfaces included.

To use the command line tool, run it from the console at the root of your project as:

```
php vendor/bin/axiom list
```

When create a resource using the command line tool, you can either specify the namespace and location of the file using the optional parameters `--location=LOCATION` and `--namespace=NAMESPACE` or using an `axiom.yaml` config file (recommended).

#### axiom.yaml

[](#axiomyaml)

The axiom.yaml file lays out the structure for your generated classes and looks something like:

```
repositories:
    - namespace: Acme\Repositories
    - location: /Users/enzyme/code/acme/Repositories
factories:
    - namespace: Acme\Factories
    - location: /Users/enzyme/code/acme/Factories
bags:
    - namespace: Acme\Bags
    - location: /Users/enzyme/code/acme/Bags
atoms:
    - namespace: Acme\Atoms
    - location: /Users/enzyme/code/acme/Atoms
reports:
    - namespace: Acme\Reports
    - location: /Users/enzyme/code/acme/Reports
models:
    - namespace: Acme\Models
    - location: /Users/enzyme/code/acme/Models
```

When generating a class using the command line tool and no entry for the class type is found in the `axiom.yaml` (optional) file or through the command line parameter, an exception will be thrown.

#### Resource stack

[](#resource-stack)

To create an entire resource stack, which includes a repository, factory, bag and model for a domain resource, you can use the `make:stack` command. This command does not accept namespaces and locations from the command line, so you will need a `axiom.yaml` file present. If you want to use the stack generator but want to ignore one or more of the included generated classes, you can use the `--ignore` parameter. Simply pass the `--ignore` parameter a string with a comma-delimited list of the resource types to ignore, eg: `--ignore="model"` or `--ignore="factory,bag"`.

Contributing
============

[](#contributing)

Please see `CONTRIBUTING.md`

License
=======

[](#license)

MIT - Copyright (c) 2015 Tristan Strathearn, see `LICENSE`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 98.6% 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 ~5 days

Total

17

Last Release

3694d ago

Major Versions

v0.2.0 → 1.0.02016-02-14

1.0.0 → v2.0.02016-03-06

v2.0.0 → v3.0.02016-03-13

v3.1.1 → v4.0.02016-04-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/148afe40f056b8f57e43ed0505c6040f762e26805b1d1bebed87484d529bae07?d=identicon)[r3oath](/maintainers/r3oath)

---

Top Contributors

[![r3oath](https://avatars.githubusercontent.com/u/2805249?v=4)](https://github.com/r3oath "r3oath (69 commits)")[![lpmi-13](https://avatars.githubusercontent.com/u/5070516?v=4)](https://github.com/lpmi-13 "lpmi-13 (1 commits)")

---

Tags

phpinterfaceshexdddaxiomenzyme

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)[robiningelbrecht/phpunit-coverage-tools

PHPUnit coverage tools

1783.0k34](/packages/robiningelbrecht-phpunit-coverage-tools)

PHPackages © 2026

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