PHPackages                             timitao/behatclipboard - 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. timitao/behatclipboard

ActiveBehat-extension[Testing &amp; Quality](/categories/testing)

timitao/behatclipboard
======================

v1.0.6(11y ago)215.4k↓21.4%MITPHPPHP &gt;=5.4

Since Nov 25Pushed 11y ago1 watchersCompare

[ Source](https://github.com/timiTao/BehatClipboard)[ Packagist](https://packagist.org/packages/timitao/behatclipboard)[ RSS](/packages/timitao-behatclipboard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (9)Used By (0)

[![License](https://camo.githubusercontent.com/7a23c82515f5552463b842ffb9cd70315939dd59427c254639302a7dc12f6b8d/68747470733a2f2f706f7365722e707567782e6f72672f74696d6974616f2f6265686174636c6970626f6172642f6c6963656e73652e737667)](https://packagist.org/packages/timitao/behatclipboard)[![Latest Stable Version](https://camo.githubusercontent.com/a71f2cf5f1869a1a1ebdedeb1753ec01f654a3cfeaadfd5e4dc8667728737bb5/68747470733a2f2f706f7365722e707567782e6f72672f74696d6974616f2f6265686174636c6970626f6172642f762f737461626c652e737667)](https://packagist.org/packages/timitao/behatclipboard)[![Latest Unstable Version](https://camo.githubusercontent.com/a5aa73b53c86044ce55206c0b1728ba8a5434d170d2896861d3ef62f8f07adb6/68747470733a2f2f706f7365722e707567782e6f72672f74696d6974616f2f6265686174636c6970626f6172642f762f756e737461626c652e737667)](https://packagist.org/packages/timitao/behatclipboard)[![Total Downloads](https://camo.githubusercontent.com/f34176ab091ccdb0fea0350839372d1de4e68b105ff337f978d0c5fa02a473db/68747470733a2f2f706f7365722e707567782e6f72672f74696d6974616f2f6265686174636c6970626f6172642f646f776e6c6f6164732e737667)](https://packagist.org/packages/timitao/behatclipboard)[![SensioLabsInsight](https://camo.githubusercontent.com/f16c9293cfe87ebdbe19445fbf7a866ede3c9d38174beabb5b0bfeb9bc46a06d/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f38313934343466352d616361632d343530382d626633662d3138356365663964643465632f6d696e692e706e67)](https://insight.sensiolabs.com/projects/819444f5-acac-4508-bf3f-185cef9dd4ec)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c6b941baa8a7dfd0ac6400e599055fc2492181c11752d9faab0aa542095acb23/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74696d6974616f2f6265686174636c6970626f6172642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/timitao/behatclipboard/?branch=master)[![Build Status](https://camo.githubusercontent.com/34bf95df0847066b7d9c71604f3460d8dcc590daaa4263f975ec3a690c94918c/68747470733a2f2f7472617669732d63692e6f72672f74696d6954616f2f4265686174436c6970626f6172642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/timiTao/BehatClipboard)

BehatClipboard
==============

[](#behatclipboard)

BehatClipboard is an integration layer between contexts in Behat 3.0+ and it provides:

- Additional service for Behat `Clipboard`,
- base `Behat\ClipboardExtension\Context\FeatureContext` context which provides base step definitions for your contexts,
- allow to share data between contexts - all,
- allow to use keys, in scenarios - and will be replaced, in: \*\* TableNode \*\* PyString \*\* Value

Purpose of this is that, I'm testing REST API. In return I get JSON that want call universal way. I'm saving last respond to clipboard and freely call this by `clipboard(last_response.body.KEY.KEY.KEY)`

Flow
----

[](#flow)

System generate a container that hold data. We could save there and read inside context. Clipboard will we shared between all context that implement interface `Behat\ClipboardExtension\Context\ClipboardContextAwareInterface`;

Extension add event for transform data in scenario with given `prefix` and `pattern`.

In default, it will look for example: `clipboard(test1)`, where `test1` is key from clipboard and replace in scenario before execute step. The transform not depend on given context.

```
Given Clipboard save the value "10" on key "test1"
#in next step clipboard.test1 will be transformed to 10, and send to step
And Clipboard over key "clipboard(test1)" have "10"

```

Minimum functionality you need to implement in your context is saving to clipboard. Like in `Behat\ClipboardExtension\Context\FeatureContext`:

```
/**
 * @Then Clipboard save the value :arg1 on key :arg2
 *
 * @param $arg1
 * @param $arg2
 */
public function clipboardSaveTheValueOnKey($arg1, $arg2)
{
    $this->clipboard->set($arg2, $arg1);
}

```

Installing extension
--------------------

[](#installing-extension)

The easiest way to install is by using [Composer](https://getcomposer.org):

```
$> curl -sS https://getcomposer.org/installer | php
$> php composer.phar require timitao/behatclipboard='1.0.*'
```

or composer.json

```
"require": {
    "timitao/behatclipboard": "1.0.*"
},

```

Action
------

[](#action)

Base context allow:

- save value on key to clipboard
- check containing KEY by clipboard
- copy from KEY1 to KEY2
- save multi values by TableNode
- save PyString by key

Examples
--------

[](#examples)

Look at this [clipboard.feature](https://github.com/timiTao/BehatClipboard/blob/master/features/clipboard.feature)

Default
-------

[](#default)

We can define default values for clipboard by:

```
extensions:
    Behat\ClipboardExtension\ClipboardExtension:
        defaults:
            key1: value1
            key2.key2 : value2

```

Extra
-----

[](#extra)

Additionally, it assist dotNotification.

If you save array on `[test=>[test2=>15]]` in scenario, you could call this by

- `clipboard(test1)` to get `[test2=>15]`
- `clipboard(test.test2)` to get `15`

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

[](#configuration)

Actually used configuration:

- `prefix` - prefix for recognise data in scenario to replace. Default: `clipboard`
- `pattern` - pattern that will be complete with prefix and looking data to transform from clipboard. Default: `/%s\(([a-zA-Z0-9_\.\-]+)\)/`

Suggestion
----------

[](#suggestion)

Suggested to use with [Behat Assert Context](https://github.com/timiTao/BehatAssertContext).

Versioning
----------

[](#versioning)

Staring version `1.0.0`, will follow [Semantic Versioning v2.0.0](http://semver.org/spec/v2.0.0.html).

Contributors
------------

[](#contributors)

- Tomasz Kunicki [TimiTao](http://github.com/timiTao) \[lead developer\]

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~29 days

Total

8

Last Release

4052d ago

Major Versions

v0.5 → v1.0.02014-12-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2f588f9271b5a4b2bccdbf3c387b1769db408a23f675d83885371b0dd4bde2b?d=identicon)[timiTao](/maintainers/timiTao)

---

Top Contributors

[![timiTao](https://avatars.githubusercontent.com/u/6087694?v=4)](https://github.com/timiTao "timiTao (2 commits)")

---

Tags

testguiBehatextension

### Embed Badge

![Health badge](/badges/timitao-behatclipboard/health.svg)

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

###  Alternatives

[robertfausk/behat-panther-extension

Symfony Panther extension for Behat

341.7M87](/packages/robertfausk-behat-panther-extension)[laracasts/behat-laravel-extension

Laravel extension for Behat

2611.3M12](/packages/laracasts-behat-laravel-extension)[dvdoug/behat-code-coverage

Generate Code Coverage reports for Behat tests

593.6M37](/packages/dvdoug-behat-code-coverage)[leanphp/behat-code-coverage

Generate Code Coverage reports for Behat tests

50359.8k2](/packages/leanphp-behat-code-coverage)[drupal/tqextension

Behat extension for testing Drupal sites

1134.4k](/packages/drupal-tqextension)[kielabokkie/jsonapi-behat-extension

Behat extension for testing JSON APIs

1516.5k](/packages/kielabokkie-jsonapi-behat-extension)

PHPackages © 2026

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