PHPackages                             techdivision/php-by-contract - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. techdivision/php-by-contract

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

techdivision/php-by-contract
============================

A lightweight Design-by-Contract library for PHP

0.3.4(11y ago)132.3k21OSL 3.0PHPPHP &gt;=5.4.0

Since Jul 11Pushed 11y ago12 watchersCompare

[ Source](https://github.com/techdivision/php-by-contract)[ Packagist](https://packagist.org/packages/techdivision/php-by-contract)[ RSS](/packages/techdivision-php-by-contract/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (2)Versions (10)Used By (1)

php-by-contract (deprecated)
============================

[](#php-by-contract-deprecated)

A lightweight design by contract library for PHP

[![Latest Stable Version](https://camo.githubusercontent.com/41a6f232f9dfb60abfcc0dd1b261b7ffa3a632495b05fbf51ff31dc67360e897/68747470733a2f2f706f7365722e707567782e6f72672f746563686469766973696f6e2f7068702d62792d636f6e74726163742f762f737461626c652e706e67)](https://packagist.org/packages/techdivision/php-by-contract) [![Total Downloads](https://camo.githubusercontent.com/75f1b581abd0126c1d86f542016306e2d96576e7fd2192a3eca2174c52e4fac8/68747470733a2f2f706f7365722e707567782e6f72672f746563686469766973696f6e2f7068702d62792d636f6e74726163742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/techdivision/php-by-contract) [![License](https://camo.githubusercontent.com/a2403232ae588c4ebc3920c648dcc5e4722b6c317caeaee054f9f36b6e35c75d/68747470733a2f2f706f7365722e707567782e6f72672f746563686469766973696f6e2f7068702d62792d636f6e74726163742f6c6963656e73652e706e67)](https://packagist.org/packages/techdivision/php-by-contract) [![Build Status](https://camo.githubusercontent.com/f38a5325a484693a4fd73ba2d81c18ac4db9769e0e523f9d639ecf8f6aae5230/68747470733a2f2f7472617669732d63692e6f72672f746563686469766973696f6e2f7068702d62792d636f6e74726163742e706e67)](https://travis-ci.org/techdivision/php-by-contract) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/cdda0e8a036ada5cf1687b0b4fb290a328a0b38093a73a9fe5c12e2a0e1d71da/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746563686469766973696f6e2f7068702d62792d636f6e74726163742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/techdivision/php-by-contract/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/e9333863b3a15d18b5c2635cee792493bcba6a4eeb30c2ae6f81a7ddf80bf6e0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746563686469766973696f6e2f7068702d62792d636f6e74726163742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/techdivision/php-by-contract/?branch=master)

Introduction
============

[](#introduction)

What is php-by-contract?
------------------------

[](#what-is-php-by-contract)

php-by-contract strives to be a lightweight [`Design by Contract`](http://en.wikipedia.org/wiki/Design_by_contract) library for PHP which can be added with minimal changes to any existing projects. With Design by Contract you can enforce the object oriented structure of your code and secure the interaction of these objects with one another.

Deprecation
===========

[](#deprecation)

This repository is no longer under development nor is it maintained! If you want to use Design by contract have a look at [Doppelgaenger](https://github.com/appserver-io/doppelgaenger). It will be maintained instead of this repository and additionally offers [AOP](https://en.wikipedia.org/wiki/Aspect-oriented_programming) features as well.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.1% 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 ~2 days

Total

7

Last Release

4352d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/287509?v=4)[Tim Wagner](/maintainers/wagnert)[@wagnert](https://github.com/wagnert)

![](https://avatars.githubusercontent.com/u/287595?v=4)[Johann Zelger](/maintainers/zelgerj)[@zelgerj](https://github.com/zelgerj)

![](https://avatars.githubusercontent.com/u/4931168?v=4)[Bernhard Wick](/maintainers/wick-ed)[@wick-ed](https://github.com/wick-ed)

---

Top Contributors

[![wick-ed](https://avatars.githubusercontent.com/u/4931168?v=4)](https://github.com/wick-ed "wick-ed (255 commits)")[![wagnert](https://avatars.githubusercontent.com/u/287509?v=4)](https://github.com/wagnert "wagnert (5 commits)")

---

Tags

librarycontractpreconditionpostconditionDesign by contractinvariantdbc

### Embed Badge

![Health badge](/badges/techdivision-php-by-contract/health.svg)

```
[![Health](https://phpackages.com/badges/techdivision-php-by-contract/health.svg)](https://phpackages.com/packages/techdivision-php-by-contract)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)[v.chetkov/php-clean-architecture

PHP Clean Architecture

14659.9k](/packages/vchetkov-php-clean-architecture)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

749284.3k35](/packages/civicrm-civicrm-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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