Download the PHP package daycry/class-finder without Composer
On this page you can find all versions of the php package daycry/class-finder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download daycry/class-finder
More information about daycry/class-finder
Files in daycry/class-finder
Package class-finder
Short Description Namespace Class Finder
License MIT
Homepage https://github.com/daycry/class-finder
Informations about the package class-finder
ClassFinder
A high-performance utility to identify classes in a given namespace for CodeIgniter 4
✨ Features
- 🚀 High Performance: Optimized with static analysis and intelligent caching (90%+ faster than previous versions)
- 🔒 Secure: Uses static analysis instead of dynamic code execution when possible
- 🎯 Multiple Strategies: Supports PSR-4, ClassMap, and Files autoloading strategies
- ⚙️ Configurable: Flexible configuration options for different use cases
- 🔍 Comprehensive: Find classes, interfaces, traits, and functions
- 💡 Smart Fallback: Automatic fallback to ensure compatibility
Requirements
- PHP >= 8.1.0 (PHP 8.2+ recommended for optimal performance)
- Composer for dependency management and autoloading
- CodeIgniter 4 framework
Dependencies
This library automatically installs:
nikic/php-parser
- For high-performance static analysis- Standard CodeIgniter 4 dependencies
Installation
Install via Composer:
Quick Start
Usage Examples
Standard Mode (Current Namespace Only)
Recursive Mode (Include Sub-namespaces)
Advanced Options - Find Different Types
Configuration
Using Config File
Modify app/Config/ClassFinder.php
to customize the behavior:
Runtime Configuration
Configuration Methods
Performance Tips
- Use PSR-4 autoloading when possible (fastest strategy)
- Disable 'files' finder if you don't use Composer's files autoloading
- Use specific namespaces instead of broad searches
- Cache results in your application for repeated searches
Available Constants
Performance & Architecture
Finding Strategies (by performance)
- PSR-4 Finder 🚀 - Fastest, uses namespace-to-directory mapping
- ClassMap Finder ⚡ - Fast, uses Composer's class map
- Files Finder 🐌 - Slower, analyzes individual files (uses static analysis when possible)
Caching
ClassFinder implements intelligent caching at multiple levels:
- Configuration caching - Avoids repeated config loading
- Namespace result caching - Caches search results per namespace/options
- Static analysis caching - Caches parsed file results
- Factory caching - Caches autoloader data
Static Analysis
For Files finder, ClassFinder uses nikic/php-parser
for static analysis instead of executing code:
- 90%+ performance improvement over dynamic analysis
- Enhanced security - no code execution
- Automatic fallback to dynamic analysis if static analysis fails
Troubleshooting
Common Issues
Classes not found:
- Ensure classes are properly autoloaded by Composer
- Check that namespace matches directory structure (PSR-4)
- Verify the namespace spelling and case sensitivity
Performance issues:
- Disable unused finder strategies (
files
,classMap
) - Use specific namespaces instead of broad searches
- Check if PSR-4 autoloading is properly configured
Static analysis errors:
- Library automatically falls back to dynamic analysis
- Ensure PHP files have valid syntax
- Check file permissions and readability
Debug Mode
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you find this library useful, please consider:
- ⭐ Starring the repository
- 🐛 Reporting issues
- 💡 Contributing improvements
- ☕ Buying me a coffee