PHPackages                             gyro/phake-attributes - 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. gyro/phake-attributes

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

gyro/phake-attributes
=====================

A #\[Mock\] attribute for Phake inside PHPUnit and helpers.

v2.0(1y ago)057.4k—8.6%1MITPHPPHP ^8.0

Since Jul 2Pushed 1y agoCompare

[ Source](https://github.com/gyro-project/phake-attributes)[ Packagist](https://packagist.org/packages/gyro/phake-attributes)[ RSS](/packages/gyro-phake-attributes/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Phake Attributes
================

[](#phake-attributes)

This extension for Phake provides an attribute `#[Mock]` for properties that can be used in PHPUnit testcases via a trait that adds a before listener:

```
use Gyro\PhakeAttributes\Mock;
use Gyro\PhakeAttributes\PhakeAttributes;
use PHPUnit\Framework\TestCase;

class MyServiceTestCase extends TestCase
{
    use PhakeAttributes;

    #[Mock] // during setup phase in PHPUnit will call Phake::mock(MyDependencyService::class)
    private MyDependencyService $myDependency;

    public function testMyServiceMethod() : void
    {
        \Phake::when($this->myDependency)->foo()->thenReturn('bar');

        // this uses named arguments and array expansion to pass ctor arguments
        // reflection is used to find the types needed for each argument and the
        // properties and mocks in current test are searched for matches based
        //  on variable name or type.
        $service = new MyService(...$this->mockArgumentsFor(Myservice::class));

        // if you dont want to type that much:
        $service = $this->newInstanceWithMockedArgumentsFor(MyService::class);
    }
}
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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 ~288 days

Total

4

Last Release

550d ago

Major Versions

v1.2 → v2.02024-11-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/892698bb1d3f6dae0e3a44abe3e26920ddb4eb000c6c583c87b4db5e5027e166?d=identicon)[beberlei](/maintainers/beberlei)

---

Top Contributors

[![beberlei](https://avatars.githubusercontent.com/u/26936?v=4)](https://github.com/beberlei "beberlei (13 commits)")[![edorian](https://avatars.githubusercontent.com/u/247397?v=4)](https://github.com/edorian "edorian (2 commits)")

---

Tags

testing

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gyro-phake-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/gyro-phake-attributes/health.svg)](https://phpackages.com/packages/gyro-phake-attributes)
```

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k910.7M134.8k](/packages/phpunit-phpunit)[phpunit/php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

8.9k892.4M1.5k](/packages/phpunit-php-code-coverage)[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[symfony/phpunit-bridge

Provides utilities for PHPUnit, especially user deprecation notices management

2.5k201.2M4.2k](/packages/symfony-phpunit-bridge)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)

PHPackages © 2026

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