PHPackages                             ray/fake-module - 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. ray/fake-module

Abandoned → [ray/test-double](/?search=ray%2Ftest-double)Library[Testing &amp; Quality](/categories/testing)

ray/fake-module
===============

this is Ray.Di module for developing mocking feature.

0.1.0(11y ago)2223BSD-3-ClausePHP

Since May 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kuma-guy/Ray.FakeModule)[ Packagist](https://packagist.org/packages/ray/fake-module)[ RSS](/packages/ray-fake-module/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Ray.FakeModule
==============

[](#rayfakemodule)

**This package is deprecated. Please use [Ray.TestDouble](https://github.com/ray-di/Ray.TestDouble) instead.**

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/03dbf65904e5794d10b511fc67ed68bf1ff657c27b1d287536e14ba6918b84fd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7368696e676f2d6b756d616761692f5261792e46616b654d6f64756c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/shingo-kumagai/Ray.FakeModule/?branch=master) [![Build Status](https://camo.githubusercontent.com/cab105375e8968e57b7596de09a5718348673627170ec8fa3c71d3383c2029ce/68747470733a2f2f7472617669732d63692e6f72672f6b756d612d6775792f5261792e46616b654d6f64756c652e7376673f6272616e63683d312e78)](https://travis-ci.org/kuma-guy/Ray.FakeModule)

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

[](#installation)

### Composer install

[](#composer-install)

```
$ composer require ray/fake-module

```

### Module install

[](#module-install)

```
use Ray\Di\AbstractModule;
use Ray\FakeModule\FakeModule;

class AppModule extends AbstractModule
{
    protected function configure()
    {
        $this->install(new FakeModule);
    }
}
```

### Usage

[](#usage)

### Fake a resource uri.

[](#fake-a-resource-uri)

`@FakeResource` annotation fake uri for building mock feature. Annotate target resource, which you want to fake, with `@FakeResource` annotation. Then, 'Fake' prefixed resource in same namespace will be called via interceptor when original resource method called.

*this feature heavily depends on BEAR.Resource \[\]*

Real resource

```
namespace FakeVendor\Sandbox\Resource\App;

use BEAR\Resource\ResourceObject;
use Ray\FakeModule\Annotation\FakeResource;

/**
 * @FakeResource
 */
class User extends ResourceObject
{
    public function onGet($id)
    {
        // ...
    }
}
```

Fake resource

```
namespace FakeVendor\Sandbox\Resource\App;

use BEAR\Resource\ResourceObject;

class FakeUser extends ResourceObject
{
    public function onGet($id)
    {
        // ...
    }
}
```

### Fake a class method.

[](#fake-a-class-method)

`@FakeClass` annotation work as same as `@FakeResource`.

Real class.

```
namespace FakeVendor\Sandbox\Module;

use Ray\FakeModule\Annotation\FakeClass;

/**
 * @FakeClass
 */
class TestClass
{
    public function output() {
        return  "test class output";
    }
}
```

Fake class.

```
namespace FakeVendor\Sandbox\Module;

class FakeTestClass
{
    public function output() {
        return "fake class output";
    }
}
```

### Requirements

[](#requirements)

- PHP 5.5+
- hhvm

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Total

2

Last Release

3191d ago

Major Versions

0.1.0 → 1.x-dev2017-08-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/3edf42babdb017f2ec023b6cad24e3db1eacf0941bf97ea10bbd32978c3dd8be?d=identicon)[shingo-kumagai](/maintainers/shingo-kumagai)

---

Top Contributors

[![kuma-guy](https://avatars.githubusercontent.com/u/7978290?v=4)](https://github.com/kuma-guy "kuma-guy (48 commits)")

---

Tags

Ray.Di moduletestabilityFake contextFake module

### Embed Badge

![Health badge](/badges/ray-fake-module/health.svg)

```
[![Health](https://phpackages.com/badges/ray-fake-module/health.svg)](https://phpackages.com/packages/ray-fake-module)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

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

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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