PHPackages                             codeception/stub - 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. codeception/stub

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

codeception/stub
================

Flexible Stub wrapper for PHPUnit's Mock Builder

4.3.0(3mo ago)30078.0M—7.9%18[6 issues](https://github.com/Codeception/Stub/issues)[2 PRs](https://github.com/Codeception/Stub/pulls)20MITPHPPHP ^8.1CI failing

Since Jan 27Pushed 3mo ago6 watchersCompare

[ Source](https://github.com/Codeception/Stub)[ Packagist](https://packagist.org/packages/codeception/stub)[ RSS](/packages/codeception-stub/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (27)Used By (20)

Codeception\\Stub
=================

[](#codeceptionstub)

[![CI](https://github.com/Codeception/Stub/workflows/CI/badge.svg)](https://github.com/Codeception/Stub/workflows/CI/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/afb62e8a7ea682372f06dd39635048c30c4966587075029e31540a398ca3011a/68747470733a2f2f706f7365722e707567782e6f72672f636f646563657074696f6e2f737475622f762f737461626c65)](https://packagist.org/packages/codeception/stub)[![Total Downloads](https://camo.githubusercontent.com/4a11923ebe154edabd39fe80648a01d26827ff7ae75bed852db630730b3c65d0/68747470733a2f2f706f7365722e707567782e6f72672f636f646563657074696f6e2f737475622f646f776e6c6f616473)](https://packagist.org/packages/codeception/stub)[![License](https://camo.githubusercontent.com/792d5215f95a07cdb1db76cc9f22ffa35a51cc93c089715dad3fa3c29d4e27e0/68747470733a2f2f706f7365722e707567782e6f72672f636f646563657074696f6e2f737475622f6c6963656e7365)](https://packagist.org/packages/codeception/stub)

Library on top of PHPUnit's mock builder providing a highly simplified syntax:

Reference
---------

[](#reference)

- [Stub](https://github.com/Codeception/Stub/blob/master/docs/Stub.md) - creating stub classes using static methods
- [Stub Trait](https://github.com/Codeception/Stub/blob/master/docs/StubTrait.md) - creating stubs and mocks using trait
- [Expected](https://github.com/Codeception/Stub/blob/master/docs/Expected.md) - defining expectations for mocks

Install
-------

[](#install)

Enabled by default in Codeception. For PHPUnit install this package:

```
composer require codeception/stub --dev

```

Stubs
-----

[](#stubs)

Stubs can be constructed with `Codeception\Stub` static calls:

```
