Download the PHP package vicgutt/laravel-models-finder without Composer
On this page you can find all versions of the php package vicgutt/laravel-models-finder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vicgutt/laravel-models-finder
More information about vicgutt/laravel-models-finder
Files in vicgutt/laravel-models-finder
Package laravel-models-finder
Short Description Find all models in your Laravel app or package
License MIT
Homepage https://github.com/vicgutt/laravel-models-finder
Informations about the package laravel-models-finder
Find all models in your Laravel app or package
This package allows you to find and retrieve all Laravel models in a given folder.
A "model" is any class extending Illuminate\Database\Eloquent\Model
.
Here's a quick example:
Installation
You can install the package via composer:
Usage
You can initiate the discovery of models by using the find
static method.
This method accepts 3 optional arguments:
directory
: The directory in which to recusively start searching for models. Defaults toapp_path('Models')
.basePath
: The autoloaded entry directory of the project where the search will be initiated. Defaults tobase_path()
.baseNamespace
: The autoloaded base namespace of the project where the search will be initiated. Defaults to''
.
The basePath
& baseNamespace
properties will most likely correspond to an autoloaded entry in a composer.json
file.
Example:
Here's an example showcasing searching for a model in the vendor
folder:
The return value of the method is a lazy collection (Illuminate\Support\LazyCollection
).
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
If you're interested in contributing to the project, please read our contributing docs before submitting a pull request.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Victor GUTT
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-models-finder with dependencies
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^10.0