PHPackages                             letsdrink/ouzo-goodies - 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. letsdrink/ouzo-goodies

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

letsdrink/ouzo-goodies
======================

Utility classes, test assertions and mocking framework extracted from Ouzo framework.

1.8.0(5y ago)132617.9k—8.8%47MITPHP

Since Dec 30Pushed 2y ago12 watchersCompare

[ Source](https://github.com/letsdrink/ouzo-goodies)[ Packagist](https://packagist.org/packages/letsdrink/ouzo-goodies)[ Docs](http://ouzoframework.org/)[ RSS](/packages/letsdrink-ouzo-goodies/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)DependenciesVersions (9)Used By (7)

Ouzo Goodies
============

[](#ouzo-goodies)

What is it
----------

[](#what-is-it)

Utility classes, test assertions and mocking framework extracted from [Ouzo framework](https://github.com/letsdrink/ouzo). We are compatible with PHP 7.2 and later.

[![Build Status](https://camo.githubusercontent.com/24a3914a83c9d8f376a380b8b5d6a11f931e4944caa3cf1156445069f515d193/68747470733a2f2f7472617669732d63692e6f72672f6c6574736472696e6b2f6f757a6f2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/letsdrink/ouzo)[![Coverage Status](https://camo.githubusercontent.com/75bc73dc866fe4d63935e7cebca77b8bb6c9fe6c9943c24c8c81f3d52e013b92/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6c6574736472696e6b2f6f757a6f2f62616467652e737667)](https://coveralls.io/r/letsdrink/ouzo)[![Latest Stable Version](https://camo.githubusercontent.com/71b4ce86f445b01561df5993e3ead8dee6a5546884ecf9f05cea153c222f71b8/68747470733a2f2f706f7365722e707567782e6f72672f6c6574736472696e6b2f6f757a6f2d676f6f646965732f762f737461626c652e737667)](https://packagist.org/packages/letsdrink/ouzo-goodies)[![Total Downloads](https://camo.githubusercontent.com/abfaa00cbcd6e9dcc1ec97583b7305bad2107c2a17a9d481c92e58bbec99918e/68747470733a2f2f706f7365722e707567782e6f72672f6c6574736472696e6b2f6f757a6f2d676f6f646965732f646f776e6c6f6164732e737667)](https://packagist.org/packages/letsdrink/ouzo-goodies)[![License](https://camo.githubusercontent.com/b3c92fb7fbf2ab7eba31cdba233afc2df25d82bd38828d3c9bc53f848cad0d93/68747470733a2f2f706f7365722e707567782e6f72672f6c6574736472696e6b2f6f757a6f2d676f6f646965732f6c6963656e73652e737667)](https://packagist.org/packages/letsdrink/ouzo-goodies)

How to use it
-------------

[](#how-to-use-it)

Couple of examples.

[Fluent arrays](http://ouzo.readthedocs.org/en/latest/utils/fluent_array.html):

```
$result = FluentArray::from($users)
             ->map(Functions::extractField('name'))
             ->filter(Functions::notEmpty())
             ->unique()
             ->toArray();
```

[Fluent iterator](http://ouzo.readthedocs.org/en/latest/utils/fluent_iterator.html):

```
$result = FluentIterator::fromArray([1, 2, 3])
             ->cycle()
             ->limit(10)
             ->reindex()
             ->toArray(); // [1, 2, 3, 1, 2, 3, 1, 2, 3, 1]
```

[Fluent functions](http://ouzo.readthedocs.org/en/latest/utils/fluent_functions.html):

```
$product = new Product(['name' => 'super phone']);

$function = FluentFunctions::extractField('name')
      ->removePrefix('super')
      ->prepend(' extra')
      ->append('! ')
      ->surroundWith("***");

$result = Functions::call($function, $product); //=> '*** extra phone! ***'
```

```
$phones = Arrays::filter($products, FluentFunctions::extractField('type')->equals('PHONE'));
```

[Extract (from Functions)](http://ouzo.readthedocs.org/en/latest/utils/functions.html#extract):

```
$cities = Arrays::map($users, Functions::extract()->getAddress('home')->city);
```

[Clock](http://ouzo.readthedocs.org/en/latest/utils/clock.html):

```
$string = Clock::now()
    ->plusYears(1)
    ->plusMonths(2)
    ->minusDays(3)
    ->format();
```

[Comparators](http://ouzo.readthedocs.org/en/latest/utils/comparators.html):

```
$product1 = new Product(['name' => 'b']);
$product2 = new Product(['name' => 'c']);
$product3 = new Product(['name' => 'a']);

$result = Arrays::sort([$product1, $product2, $product3], Comparator::compareBy('name'));
```

[Fluent assertions for arrays](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#array-assertions):

```
$animals = ['cat', 'dog', 'pig'];
Assert::thatArray($animals)->hasSize(3)->contains('cat');
```

[Fluent assertions for strings](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#string-assertions):

```
Assert::thatString("Frodo")
     ->startsWith("Fro")
     ->endsWith("do")
     ->contains("rod")
     ->doesNotContain("fro")
     ->hasSize(5);
```

[Mocking](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#mocking):

```
$mock = Mock::create();
Mock::when($mock)->someMethod('arg')->thenReturn('123');

$result = $mock->someMethod('arg');

$this->assertEquals('123', $result);
Mock::verify($mock)->method('arg');
```

[Exception assertions](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#exception-assertions):

```
$foo = new Foo();

CatchException::when($foo)->method();

CatchException::assertThat()->isInstanceOf("FooException");
```

This is just a taste of Ouzo. Look at the documentation for more goodies.

Where to get it
---------------

[](#where-to-get-it)

Download from github or simply add composer dependency:

```
composer require letsdrink/ouzo-goodies
```

[Ouzo Goodies at packagist](https://packagist.org/packages/letsdrink/ouzo-goodies).

Documentation
-------------

[](#documentation)

Tutorials:

- [Functional programming with Ouzo](http://ouzo.readthedocs.org/en/latest/documentation/functional_programming.html)

Utilities:

- [Arrays](http://ouzo.readthedocs.org/en/latest/utils/arrays.html) - Helper functions for arrays.
- [FluentArray](http://ouzo.readthedocs.org/en/latest/utils/fluent_array.html) - Interface for manipulating arrays in a chained fashion.
- [Iterators](http://ouzo.readthedocs.org/en/latest/utils/iterators.html) - Helper functions for iterators.
- [FluentIterator](http://ouzo.readthedocs.org/en/latest/utils/fluent_iterator.html)- Interface for manipulating iterators in a chained fashion.
- [Strings](http://ouzo.readthedocs.org/en/latest/utils/strings.html) - Helper functions for strings.
- [Objects](http://ouzo.readthedocs.org/en/latest/utils/objects.html)- Helper functions that can operate on any PHP object.
- [Functions](http://ouzo.readthedocs.org/en/latest/utils/functions.html) - Static utility methods returning closures that can be used with Arrays and FluentArray, or other PHP functions.
- [FluentFunctions](http://ouzo.readthedocs.org/en/latest/utils/fluent_functions.html) - Fluent utility for function composition.
- [Cache](http://ouzo.readthedocs.org/en/latest/utils/cache.html) - General-purpose cache.
- [Path](http://ouzo.readthedocs.org/en/latest/utils/path.html) - Helper functions for path operations.
- [Clock](http://ouzo.readthedocs.org/en/latest/utils/clock.html) - DateTime replacement.
- [Comparators](http://ouzo.readthedocs.org/en/latest/utils/comparators.html) - Sorting.

Tests:

- [Assertions for arrays](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#array-assertions)
- [Assertions for exceptions](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#exception-assertions)
- [Assertions for strings](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#string-assertions)
- [Mocking](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#mocking)
- [Testing time-dependent code](http://ouzo.readthedocs.org/en/latest/documentation/tests.html#testing-time-dependent-code)

Check out full docs at

PhpStorm plugins:
-----------------

[](#phpstorm-plugins)

- [Ouzo framework plugin](http://plugins.jetbrains.com/plugin/7565?pr=)
- [DynamicReturnTypePlugin](http://plugins.jetbrains.com/plugin/7251) - for Mock and CatchException. You have to copy [dynamicReturnTypeMeta.json ](https://github.com/letsdrink/ouzo/blob/master/dynamicReturnTypeMeta.json) to your project root.

For ideas, questions, discussions write to **.

Support for PHP 5.6, 7.0 and 7.1
--------------------------------

[](#support-for-php-56-70-and-71)

Ouzo has dropped support for PHP versions older than 7.2 since Ouzo 2.x. If you want to use Ouzo with PHP 5.6, 7.0 or 7.1, please try Ouzo 1.x branch.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity68

Established project with proven stability

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

Recently: every ~524 days

Total

7

Last Release

1897d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/479b18c25fda1e49bbfd7f188e759f24de68a0ba16e5983604e7476d416ab910?d=identicon)[woru](/maintainers/woru)

![](https://www.gravatar.com/avatar/8ec556ac8796d7201b03472a75b3f10a00b389ede74f1977bbd1ee6613a84203?d=identicon)[piotrooo](/maintainers/piotrooo)

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

---

Top Contributors

[![bbankowski](https://avatars.githubusercontent.com/u/3840784?v=4)](https://github.com/bbankowski "bbankowski (99 commits)")[![piotrooo](https://avatars.githubusercontent.com/u/2005054?v=4)](https://github.com/piotrooo "piotrooo (90 commits)")[![woru](https://avatars.githubusercontent.com/u/239006?v=4)](https://github.com/woru "woru (74 commits)")[![danon](https://avatars.githubusercontent.com/u/13367735?v=4)](https://github.com/danon "danon (66 commits)")[![dominik59](https://avatars.githubusercontent.com/u/12308040?v=4)](https://github.com/dominik59 "dominik59 (9 commits)")[![Karpol](https://avatars.githubusercontent.com/u/16548691?v=4)](https://github.com/Karpol "Karpol (4 commits)")[![andrzejo](https://avatars.githubusercontent.com/u/5418932?v=4)](https://github.com/andrzejo "andrzejo (3 commits)")[![grzeg1](https://avatars.githubusercontent.com/u/8179857?v=4)](https://github.com/grzeg1 "grzeg1 (3 commits)")[![mareckii](https://avatars.githubusercontent.com/u/6033755?v=4)](https://github.com/mareckii "mareckii (3 commits)")[![IlyaPokamestov](https://avatars.githubusercontent.com/u/2771864?v=4)](https://github.com/IlyaPokamestov "IlyaPokamestov (2 commits)")[![ksucherek](https://avatars.githubusercontent.com/u/59652781?v=4)](https://github.com/ksucherek "ksucherek (2 commits)")[![iczechowski](https://avatars.githubusercontent.com/u/223993?v=4)](https://github.com/iczechowski "iczechowski (1 commits)")

---

Tags

phptestTDDmockassertsutilsutilities

### Embed Badge

![Health badge](/badges/letsdrink-ouzo-goodies/health.svg)

```
[![Health](https://phpackages.com/badges/letsdrink-ouzo-goodies/health.svg)](https://phpackages.com/packages/letsdrink-ouzo-goodies)
```

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.2M399](/packages/php-mock-php-mock-phpunit)[polishsymfonycommunity/symfony-mocker-container

Provides base Symfony dependency injection container enabling service mocking.

1468.0M237](/packages/polishsymfonycommunity-symfony-mocker-container)[php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

392.1M96](/packages/php-mock-php-mock-mockery)[php-mock/php-mock-integration

Integration package for PHP-Mock

1410.5M3](/packages/php-mock-php-mock-integration)[elliotchance/concise

Concise is test framework for using plain English and minimal code, built on PHPUnit.

45223.8k4](/packages/elliotchance-concise)

PHPackages © 2026

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