PHPackages                             smurfworks/model-finder - 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. smurfworks/model-finder

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

smurfworks/model-finder
=======================

Laravel package for finding models and building a utility index in existing Laravel projects.

v1.0.0(3y ago)04MITPHPPHP &gt;=8.0.0

Since Nov 9Pushed 3y agoCompare

[ Source](https://github.com/SmurfWorks/Model-Finder)[ Packagist](https://packagist.org/packages/smurfworks/model-finder)[ RSS](/packages/smurfworks-model-finder/feed)WikiDiscussions main Synced 1mo ago

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

SmurfWorks / Model Finder
=========================

[](#smurfworks--model-finder)

Laravel package for finding models and building a utility index in existing Laravel projects.

- Author: [Glyn Simpson](https://www.smurfworks.com) / [@SmurfWorks](https://www.twitter.com/smurfworks)
- [Change Log](./CHANGELOG.md)
- [License](./LICENSE.md)

Key features
------------

[](#key-features)

- Configure discovery of one or more namespaces to scan for Model classes
- Ignore discovery of specific models
- Discover available scopes and relations
- Discover information about attributes
- Apply custom meta to individual scopes, relations and models via PHP8 attributes

About
-----

[](#about)

This utility repository was created as a provided service for common functionality that I needed between multiple projects, both open source and proprietary - so it made sense to open source and release it so it can be used as a dependency in both contexts.

An example of model finder being used as a dependency an open source package:

Install
-------

[](#install)

```
composer require smurfworks/model-finder
```

Laravel should automatically discover the service provider and add an alias. The provider will only scan models once per request as it's a singleton service that will cache the result.

Usage
-----

[](#usage)

```
/**
 * Get the index (implement laravel caching around this as you need)
 *
 * @var array $index
 */
$index = app('model-finder')->discover();

dd($index);
```

```
// Trimmed for verbosity (...)
array:3 [
 "SmurfWorks\ModelFinderTests\SampleModels\User" => array:4 [
    "meta" => array:2 [
      "name" => "User"
      "describe" => "A user record represents a person's access to this system"
    ]
    "attributes" => array:9 [
      "id" => array:4 [
        "type" => "integer"
        "default" => null
        "fillable" => false
        "hidden" => false
      ]
      "name" => array:4 [
        "type" => "string"
        "default" => null
        "fillable" => true
        "hidden" => false
      ]
      "email" => array:4 [
        "type" => "string"
        "default" => null
        "fillable" => true
        "hidden" => false
      ]
      "password" => array:4 [
        "type" => "string"
        "default" => null
        "fillable" => true
        "hidden" => false
      ]

      ...
    ]
    "relations" => array:1 [
      "role" => array:3 [
        "type" => "BelongsTo"
        "model" => "SmurfWorks\ModelFinderTests\SampleModels\User\Role"
        "meta" => array:2 [
          "name" => "User role"
          "describe" => "The user's system role"
        ]
      ]
    ]
    "scopes" => array:2 [
      "activated" => array:1 [
        "meta" => array:2 [
          "name" => "Activated users"
          "describe" => "Activated users have set a password."
        ]
      ]
      "subscribed" => array:1 [
        "meta" => array:2 [
          "name" => "Subscribed"
          "describe" => "Users that are opted in to receive the newsletter."
        ]
      ]
    ]
  ]
  "SmurfWorks\ModelFinderTests\SampleModels\User\Permission" => array:4 [
    "meta" => array:2 [
      "name" => "User permission"
      "describe" => null
    ]

    ...
  ]

  ...
]
```

Testing
-------

[](#testing)

The testing namespace contains schema migrations to setup some simple tables, and respective sample models. Because a part of the model finding queries the schema for table data, the unit tests will run these migrations to test model discovery.

```
./vendor/bin/phpunit
```

Contributions
-------------

[](#contributions)

Contributions and issue reporting are welcome but this project is mostly the foundation for other projects I work on, so be warned there may be a significant amount of arbitrary decision making when proceeding.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

1285d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d7b052931554530f4428ba18a111c7ef8a22d220342c46a34067b1eb474d7f13?d=identicon)[smurfworks](/maintainers/smurfworks)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/smurfworks-model-finder/health.svg)

```
[![Health](https://phpackages.com/badges/smurfworks-model-finder/health.svg)](https://phpackages.com/packages/smurfworks-model-finder)
```

###  Alternatives

[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[eliashaeussler/typo3-form-consent

Extension for TYPO3 CMS that adds double opt-in functionality to EXT:form

1481.0k](/packages/eliashaeussler-typo3-form-consent)[ronasit/laravel-helpers

Provided helpers function and some helper class.

1475.7k13](/packages/ronasit-laravel-helpers)[inspiredminds/contao-fieldset-duplication

Contao extension to allow the duplication of form fieldsets in the front end by the user for additional input fields.

158.2k1](/packages/inspiredminds-contao-fieldset-duplication)[numero2/contao-storelocator

Contao Plugin for managing stores (or in common address data) and providing a frontend-search based on geo data

121.5k](/packages/numero2-contao-storelocator)

PHPackages © 2026

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