Download the PHP package bermudaphp/finder without Composer
On this page you can find all versions of the php package bermudaphp/finder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package finder
Bermuda Class Finder
Русская версия
A powerful and flexible PHP library for discovering and filtering PHP classes and related elements (classes, interfaces, traits, enums) in your codebase. Built with performance in mind and leveraging PHP 8.4+ features.
Features
- 🔍 Smart Discovery: Find classes, interfaces, traits, and enums in specified directories
- 🎯 Advanced Filtering: Rich set of filters with optimized performance
- 🚀 High Performance: Optimized algorithms with early termination and efficient pattern matching
- 🔄 Event System: Listener-based notifications for discovered elements
- 🎨 Attribute Support: Deep search through PHP 8+ attributes with pattern matching
- 📦 PSR-11 Compatible: Full dependency injection container support
- 🧩 Extensible: Easy to extend with custom filters and listeners
Installation
Requirements
- PHP 8.4 or higher
Quick Start
Basic Usage
With Filters
Available Filters
Class Type Filters
InstantiableFilter
Finds classes that can be instantiated (not abstract, interfaces, or traits):
IsAbstractFilter
Finds abstract classes:
IsFinalFilter
Finds final classes:
Interface and Inheritance Filters
ImplementsFilter
Finds classes implementing specific interfaces:
SubclassFilter
Finds classes extending a specific parent class:
Callable Filter
CallableFilter
Finds callable classes (classes with __invoke
method):
Pattern Matching Filters
PatternFilter
Smart pattern matching with automatic target detection:
Attribute Filters
Deep Search Feature
The deepSearch
parameter in attribute filters controls the scope of attribute searching:
deepSearch: false
(default): Searches only for attributes on the class itselfdeepSearch: true
: Extends search to include attributes on class members:- Method attributes
- Property attributes
- Constant attributes
AttributeSearchFilter
Advanced attribute filtering with multiple search options:
AttributePatternFilter
Pattern matching for attribute names:
Filter Combination
ChainableFilter (AND Logic)
Combines multiple filters with AND logic - an element must pass ALL filters to be accepted:
OneOfFilter (OR Logic)
Combines multiple filters with OR logic - an element only needs to pass ONE filter to be accepted:
Complex Filter Combinations
Combine different logic types for sophisticated filtering:
Advanced Usage
Combining Multiple Filters
Using with Dependency Injection
Event Listeners
Listen for discovered classes:
Search Modes
Control what types of class elements to discover using bitwise flags:
Available Search Mode Constants:
SEARCH_CLASSES = 1
- Find only classesSEARCH_INTERFACES = 2
- Find only interfacesSEARCH_TRAITS = 4
- Find only traitsSEARCH_ENUMS = 8
- Find only enumsSEARCH_ALL = 15
- Find all OOP elements (default)
Working with Results
Performance Tips
- Use specific filters: The more specific your filters, the faster the search
- Order matters: Place the most restrictive filters first
- Pattern optimization: Simple patterns (prefix, suffix, contains) are automatically optimized
- Reflection caching: Repeated searches on the same classes benefit from reflection caching
Configuration
Container Configuration
Examples
Find All Controllers
Find Services with Dependency Injection
Find Classes with Deep Attribute Search
Find Test Classes
Find API Endpoints
Complex Filter Logic
Flexible Component Discovery
License
This project is licensed under the MIT License - see the LICENSE file for details.
All versions of finder with dependencies
bermudaphp/tokenizer Version ^1.0
symfony/finder Version ^7.2.2
bermudaphp/filter Version ^1.0
psr/container Version ^2.0.2