PHPackages                             rmiller/exemplify-extension - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. rmiller/exemplify-extension

ActiveLibrary[Testing &amp; Quality](/categories/testing)

rmiller/exemplify-extension
===========================

PhpSpec extension that adds exemplify command to generate examples in specs

0.5.0(9y ago)520.5k2[1 issues](https://github.com/richardmiller/ExemplifyExtension/issues)9MITPHPPHP &gt;=5.4

Since Nov 4Pushed 9y ago3 watchersCompare

[ Source](https://github.com/richardmiller/ExemplifyExtension)[ Packagist](https://packagist.org/packages/rmiller/exemplify-extension)[ Docs](https://github.com/richardmiller/ExemplifyExtension)[ RSS](/packages/rmiller-exemplify-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (8)Used By (9)

ExemplifyExtension
==================

[](#exemplifyextension)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b711dcafdf8a4ede579f318405cd589564b8105b24cab5f1ae8d5c703f840172/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f726963686172646d696c6c65722f4578656d706c696679457874656e73696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/richardmiller/ExemplifyExtension/?branch=master)[![Build Status](https://camo.githubusercontent.com/dcaa6556ce06d13d06b972a0a55c191348be272a0c5c6430b1a41cd0cfa6cafa/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f726963686172646d696c6c65722f4578656d706c696679457874656e73696f6e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/richardmiller/ExemplifyExtension/build-status/master)

PhpSpec extension that adds exemplify command to generate examples in specs.

For example, running:

```
bin/phpspec exemplify RMiller/Badger dig

```

And choosing the default option of 'instance method', will add the following example to the spec/RMiller/BadgerSpec class:

```
public function it_should_dig()
{
    $this->dig();
}

```

This can then be modified to describe the behaviour for the method.

Installation
------------

[](#installation)

Requires:

- PhpSpec 3.0+
- PHP 5.6+

To use 'named constructor' examples , you need to use phpspec `>2.1`. Otherwise the examples will be created but will not run.

Require the extension:

```
$ composer require --dev rmiller/exemplify-extension:^0.5

```

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

[](#configuration)

Activate the extension by specifying its class in your `phpspec.yml`:

```
# phpspec.yml
extensions:
    RMiller\BehatSpec\Extension\ExemplifyExtension\ExemplifyExtension: ~
```

Method Types
------------

[](#method-types)

Three different method types are supported, on running the command you will be asked which type of method is being described. These are:

- Instance Method (e.g. $this-&gt;dig())
- Static Method (e.g. $this::dig())
- Named Constructor

The names constructor option is for static methods used to instantiate and return an instance of the class. It is essentially another name for a factory method. This is listed separately as the example created is different.

For example, running:

```
bin/phpspec exemplify RMiller/Badger withName

```

And choosing the option of 'named constructor', will add the following to the spec/RMiller/BadgerSpec class:

```
public function it_should_be_constructed_through_with_name()
{
    $this->beConstructedThrough('withName');
}

```

Other Potentially Useful Extensions
-----------------------------------

[](#other-potentially-useful-extensions)

- For further laziness [PhpSpecRunExtension](https://github.com/richardmiller/PhpSpecRunExtension)will execute the phpspec run command after the describe and exemplify commands, saving a few keystrokes.
- This extension and PhpSpecRun are also part of [BehatSpec](https://github.com/richardmiller/BehatSpec)which provides integration between Behat and PhpSpec. This includes running the exemplify command automatically for missing methods encountered when running Behat features.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

5

Last Release

3392d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/442882d0e62a3acd7f3480cc8a07beeb3098dadbaaecb501eea945374ce55e1b?d=identicon)[mr\_r\_miller](/maintainers/mr_r_miller)

---

Top Contributors

[![ek9](https://avatars.githubusercontent.com/u/17393048?v=4)](https://github.com/ek9 "ek9 (8 commits)")[![pocky](https://avatars.githubusercontent.com/u/204451?v=4)](https://github.com/pocky "pocky (7 commits)")[![richardmiller-zz](https://avatars.githubusercontent.com/u/783827?v=4)](https://github.com/richardmiller-zz "richardmiller-zz (3 commits)")

---

Tags

BDDphpspec

###  Code Quality

TestsBehat

### Embed Badge

![Health badge](/badges/rmiller-exemplify-extension/health.svg)

```
[![Health](https://phpackages.com/badges/rmiller-exemplify-extension/health.svg)](https://phpackages.com/packages/rmiller-exemplify-extension)
```

###  Alternatives

[bossa/phpspec2-expect

Helper that decorates any SUS with a phpspec lazy object wrapper

741.8M87](/packages/bossa-phpspec2-expect)[benconstable/phpspec-laravel

Test your Laravel applications with PhpSpec

144347.1k15](/packages/benconstable-phpspec-laravel)[ciaranmcnulty/phpspec-typehintedmethods

Extension for phpspec to enhance generated methods

3089.3k31](/packages/ciaranmcnulty-phpspec-typehintedmethods)[phpspec/nyan-formatters

PHPSpec Nyan Formatter Extension

77239.9k22](/packages/phpspec-nyan-formatters)[friends-of-phpspec/phpspec-code-coverage

Generate Code Coverage reports for PhpSpec tests

202.6M123](/packages/friends-of-phpspec-phpspec-code-coverage)[rmiller/behat-spec

Behat and PhpSpec integration

5321.7k8](/packages/rmiller-behat-spec)

PHPackages © 2026

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