Download the PHP package darkghosthunter/larafind without Composer
On this page you can find all versions of the php package darkghosthunter/larafind. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download darkghosthunter/larafind
More information about darkghosthunter/larafind
Files in darkghosthunter/larafind
Package larafind
Short Description Small utility to find PSR-4 classes from the project path.
License MIT
Homepage https://github.com/darkghosthunter/larafind
Informations about the package larafind
Superseded by Laragear\Meta.
Larafind
Small utility to find PSR-4 classes from the base application path or project root.
You can use this as a way to "auto-discover" classes a developer (or you) may have under a given directory.
Requirements
- PHP 8.0
- Laravel 8.x
Installation
You can install the package via composer:
Usage
Use the Find
facade to easy your development pain. The facade creates a "builder" of sorts that will return a list of all discovered PSR-4 compliant classes as a ReflectionClass
.
By default, the Finder will use the default app
directory, but you can use the path()
method to look for a specific folder in your application path.
To look for other paths inside your project root, use the basePath()
method. Note that Finder ensures the path you're using is autoloaded.
Recursive
The discovery is recursive, meaning, it will expand into child directories. You can make it non-recursive using nonRecursive()
:
Filtering
The Find
returns a Collection of items, so you can use the filter()
method to get only those classes that pass a truth test.
To make things simpler, you can use some pre-filtering methods to avoid calling a filter manually after you get the collection:
Method | Description |
---|---|
implementing() |
Filter by implementing interfaces. |
extends() |
Filter by extending class. |
uses() |
Filter by used all traits. |
methods() |
Filter by public methods. |
properties() |
Filter by public properties. |
License
The MIT License (MIT). Please see License File for more information.
All versions of larafind with dependencies
illuminate/container Version 8.*
symfony/finder Version 5.*
illuminate/support Version 8.*