PHPackages                             perfumer/contracts - 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. perfumer/contracts

Abandoned → [perfumerlabs/perfumer](/?search=perfumerlabs%2Fperfumer)Library[Utility &amp; Helpers](/categories/utility)

perfumer/contracts
==================

Code generating tool

v0.14.0(8y ago)02.9kMITPHPPHP &gt;=7.1.0

Since Jan 21Pushed 3y agoCompare

[ Source](https://github.com/perfumer/contracts)[ Packagist](https://packagist.org/packages/perfumer/contracts)[ Docs](https://github.com/barmanlabs/php)[ RSS](/packages/perfumer-contracts/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (4)Versions (19)Used By (0)

Barman is a tool for generating php classes. It uses [zend-code](https://github.com/zendframework/zend-code) to generate class and [Doctrine Annotations](https://github.com/doctrine/annotations) to add annotations which mutate class and method generators in needed way.

Barman provides DSL (based on annotations) to describe method execution order and generate unit tests.

Built-in annotations
====================

[](#built-in-annotations)

- Alias - replaces string variables in method scope with Variable Annotations
- Context - defines context class or call context object if used as Step
- Custom - defines call of custom method in contract class
- Error - call method of Context if validation fails
- Inject - replaces string variables with Variable Annotations (placed in Context method Annotation scope)
- Injection - defines injected class or primitive or call injected object if used as Step
- Output - this variable will be returned by method
- Property - use class property as variable
- ServiceObject - call method of object in method scope (i.e. $some\_object-&gt;someMethod())
- ServiceParent - call method of parent class (i.e. parent::someMethod())
- ServiceProperty - call method of class property (i.e. $this-&gt;some\_property-&gt;someMethod())
- ServiceSelf - call static method of the class (i.e. self::someMethod())
- ServiceStatic - call static method of some class (i.e. SomeClass::someMethod())
- ServiceThis - call method from the class (i.e. $this-&gt;someMethod())
- Test - generate unit test for this method

Annotation fields
=================

[](#annotation-fields)

- Alias
    - name {string} - name of variable in scope
    - variable {Annotation} - object annotation that will replace a variable
- Context (extends Step)
    - name {string} - short name of the context
    - class {string} - fully qualified name of the class
- Custom (extends Step)
- Error (extends Context)
- Inject
    - name {string} - name of argument in Context method
    - variable {Annotation} - object annotation that will replace an argument
- Injection (extends Step)
    - name {string} - short name of the injection
    - type {string} - fully qualified name of the class or primitive type
- Output
- Property
    - name {string} - name of class property
- ServiceObject (extends Step)
    - name {string} - name of object in scope
- ServiceParent (extends Step)
- ServiceProperty (extends Step)
    - name {string} - name of class property
- ServiceSelf (extends Step)
- ServiceStatic (extends Step)
    - name {string} - fully qualified name of the class
- ServiceThis (extends Step)
- Step
    - method {string} - name of method of the called object
    - arguments {array} - arguments passed to method
    - return {string|array} - returned variable names
    - if {string} - step proceeds, if this is true
    - unless {string} - step proceeds, if this is false
- Test

Lifecycle (creating own annotations)
====================================

[](#lifecycle-creating-own-annotations)

- Generators are set to class annotations.
- onCreate() is called on class annotations.
- Class annotations implemented ClassAnnotationMutator mutate class annotations.
- onMutate() is called on class annotations.
- Generators are set to method annotations.
- onCreate() is called on method annotations.
- Class annotations implemented MethodAnnotationMutator mutate method annotations.
- Method annotations implemented MethodAnnotationMutator mutate method annotations.
- onMutate() is called on method annotations.
- Method annotations implemented StepGeneratorMutator mutate step generators.
- Class annotations implemented StepGeneratorMutator mutate step generators.
- Class annotations implemented MethodGeneratorMutator mutate method generators.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community6

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

Recently: every ~32 days

Total

17

Last Release

3222d ago

PHP version history (2 changes)v0.1.0PHP &gt;=7.0.0

v0.14.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/00041adfb08223ce8c9b22b92a98c0c4b5a39fbb3da1323bdca14a7887ceb603?d=identicon)[blumfontein](/maintainers/blumfontein)

---

Top Contributors

[![blumfontein](https://avatars.githubusercontent.com/u/2392350?v=4)](https://github.com/blumfontein "blumfontein (20 commits)")

---

Tags

generator

### Embed Badge

![Health badge](/badges/perfumer-contracts/health.svg)

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

###  Alternatives

[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

53675.5k17](/packages/solspace-craft-freeform)[oat-sa/generis

TAO generis library

10144.6k109](/packages/oat-sa-generis)

PHPackages © 2026

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