PHPackages                             shift31/glean - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. shift31/glean

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

shift31/glean
=============

Generate fixture files from the output of any object method

1.0(11y ago)1571MITPHPPHP &gt;=5.4.0

Since Dec 29Pushed 11y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (3)Used By (0)

Glean
=====

[](#glean)

**A fixture generator for Laravel**

This library provides a Laravel Artisan command which generates fixture files from the output of any object method. It leverages Laravel's Service Container and PHP's Reflection capabilities to instantiate classes and call the desired object methods with the specified arguments. Data may be saved in raw PHP, YAML, JSON, or XML.

Use Case
--------

[](#use-case)

While there are quite a few test double libraries designed to ingest fixtures (which reflect model classes) for the purpose of database seeding, in complex applications, it may be desirable to have reusable fixture data from other types of classes (i.e. services). *Glean* provides an easy way to capture arbitrary/complex data structures. The fixture files generated by this tool are intended to be used with unit tests in any case where you might need to reuse expectation data (i.e. stubbing).

Usage
-----

[](#usage)

1. `composer require shift31/glean`
2. Add `Shift31\Glean\GleanServiceProvider` to the `'providers'` array in your app/config/app.php.

### Help

[](#help)

Run `php artisan help glean` from the root of your Laravel project

### Examples

[](#examples)

Imagine a `Acme\Users\UsersService` class with a `getUserRoles($userId)` method that returns an array of roles for a particular user:

`php artisan glean -a user_roles 'Acme\Users\UsersService' getUserRoles 12345`

By default, this will generate a PHP file in app/storage/fixtures called user\_roles.php with the data *gleaned* from `UsersService::getUserRoles`.

#### With interfaces

[](#with-interfaces)

*Glean* resolves classes using Laravel's Service Container, so feel free to specify an interface for the `className` argument.

#### In a test

[](#in-a-test)

```
$expectedUserRoles = include(__DIR__ . '/../app/storage/fixtures/user_roles.php');
```

Limitations
-----------

[](#limitations)

Method arguments can only be PHP scalar values or `null`. A possible workaround for this is to extend the `GleanCommand` class and create your own custom "gleaner."

Todo
----

[](#todo)

- Build a fixture loader
- Make it framework-agnostic?
- Make writing custom gleaners easier?

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Unknown

Total

1

Last Release

4157d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a0e0acacc177f3fa8a27ea5064d5d31b249f0cbf08ef985af77de8499b35ced?d=identicon)[shift31](/maintainers/shift31)

---

Top Contributors

[![bgetsug](https://avatars.githubusercontent.com/u/1869022?v=4)](https://github.com/bgetsug "bgetsug (3 commits)")

### Embed Badge

![Health badge](/badges/shift31-glean/health.svg)

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

###  Alternatives

[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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