PHPackages                             reecem/mocker - 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. reecem/mocker

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

reecem/mocker
=============

Mock class constructor args based on the reflection class

v1.2.1(3y ago)7261.3k↓43.2%16[2 issues](https://github.com/ReeceM/mocker/issues)[1 PRs](https://github.com/ReeceM/mocker/pulls)10MITPHPCI failing

Since Apr 29Pushed 3y ago2 watchersCompare

[ Source](https://github.com/ReeceM/mocker)[ Packagist](https://packagist.org/packages/reecem/mocker)[ Docs](https://github.com/reecem/mocker)[ Fund](https://www.paypal.me/iexistin3d)[ GitHub Sponsors](https://github.com/reecem)[ RSS](/packages/reecem-mocker/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (4)Versions (13)Used By (10)

Reflection Mocker
=================

[](#reflection-mocker)

[ ![](https://camo.githubusercontent.com/773fa681c0f6e20aac83b9ede9e33f173e63f98f22651c20dc867b1cb1fe8de0/68747470733a2f2f636f6465636f762e696f2f67682f52656563654d2f6d6f636b65722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/ReeceM/mocker)[ ![](https://camo.githubusercontent.com/b18aaf932657346c971b3a7f1ee80c3814a0f1e65981e222e85202e9f058910f/68747470733a2f2f7472617669732d63692e636f6d2f52656563654d2f6d6f636b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/ReeceM/mocker)[![Latest Stable Version](https://camo.githubusercontent.com/8230d179648d8dd59d9fe6c9e203f1d7c9ed212e9585ab2bd1be33b4a9319596/68747470733a2f2f706f7365722e707567782e6f72672f72656563656d2f6d6f636b65722f762f737461626c65)](https://packagist.org/packages/reecem/mocker)[![License](https://camo.githubusercontent.com/6bc32a7a33944b3efdee9bc4bf3369b1fbc2a1ff121a2f3037a0e0608c884aca/68747470733a2f2f706f7365722e707567782e6f72672f72656563656d2f6d6f636b65722f6c6963656e7365)](https://packagist.org/packages/reecem/mocker)[![Downloads](https://camo.githubusercontent.com/111b517c52722bc6e4d6e11a58f235af61b46004b6aa643d5a8d39387c15c6ab/68747470733a2f2f706f7365722e707567782e6f72672f72656563656d2f6d6f636b65722f646f776e6c6f616473)](https://packagist.org/packages/reecem/mocker)

This package is initially made to for an issue on the MailEclipse package, but improvements are welcome. It currently is probably stupid simple, but deals with the one job of reading a file and mocking it.

> Generate a mocked instance of the un-typed params in a \_\_construct() method

This searches the file retrieved from the reflection class and looks for all object like arrow calls; ie:

```
...
public function __construct($objectArg, string $arg)
{
    $this->value    = $objectArg->value; // this will be picked up
    $this->name     = $arg;
}
...
```

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

[](#installation)

You can install the package via composer:

```
composer require reecem/mocker
```

Requirements
------------

[](#requirements)

- Laravel ^5.6 (min)

Usage
-----

[](#usage)

```
use ReeceM\ReflectionMockery;

/**
 * The class __construct Method is automatically read and args created
 */
$mock = new ReflectionMockery('\App\User');
// or
$mock = new ReflectionMockery(new \ReflectionClass('\App\User'));

// some time later

/**
 * Use call a variable from the class that don't exist
 */
{{ $mock->get('somethingNotInUser') }}
{{ $mock->somethingNotInUser }}

// both would return

"mock->somethingNotInUser"
// if something was set in user
'mock->somethingNotInUser => ["value that set"]'
```

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [ReeceM](https://github.com/ReeceM)
- [All Contributors](../../contributors)

todo
----

[](#todo)

- Add functionality to account for `$this->internal = $param;` searching so it works later on in the code
- Add a translation file for mocked values when testing to give a translated result for previews

Support
-------

[](#support)

Consider supporting some code if it is useful to you 😄

- [MailEclipse](https://github.com/Qoraiche/laravel-mail-editor) "just a small donation from Laravel mail editor owner, thanks for your contributions"

[![Buy Me a Coffee at ko-fi.com](https://camo.githubusercontent.com/c66a3b97bd969f336e4089211ab1a116386b434dfd7f3d793b1248986e7778d2/68747470733a2f2f617a3734333730322e766f2e6d7365636e642e6e65742f63646e2f6b6f6669342e706e673f763d32)](http://bit.ly/2J4ZPBM)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

Sponsors
--------

[](#sponsors)

    [ ![](https://user-images.githubusercontent.com/15586492/96636404-2c18dd00-1315-11eb-9520-736dffaaf0a7.png) ](https://www.jetbrains.com/?from=maileclipse)

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 94.6% 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 ~143 days

Recently: every ~280 days

Total

11

Last Release

1188d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2767904?v=4)[Reece May](/maintainers/ReeceM)[@ReeceM](https://github.com/ReeceM)

---

Top Contributors

[![ReeceM](https://avatars.githubusercontent.com/u/2767904?v=4)](https://github.com/ReeceM "ReeceM (70 commits)")[![blakehooks](https://avatars.githubusercontent.com/u/2652600?v=4)](https://github.com/blakehooks "blakehooks (2 commits)")[![Qoraiche](https://avatars.githubusercontent.com/u/15586492?v=4)](https://github.com/Qoraiche "Qoraiche (2 commits)")

---

Tags

helperlaravelmockermockingmocking-utilityphpreflectiontestinglaravelhelpermockerymockerreecem

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/reecem-mocker/health.svg)

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

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M201](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

4925.3k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

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