pyrsmk / php-class
PHP class loader
Installs: 76
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/pyrsmk/php-class
Requires
- php: >=7.2.0
This package is auto-updated.
Last update: 2025-09-29 02:00:04 UTC
README
PhpClass is a PHP class loader that allows you to load and instantiate class files on-the-fly. It was created to be able to load classes which names cannot be known before runtime, as ReflectionClass do not support loading from files.
Installing
composer require pyrsmk/php-class
Use
$phpClass = new PhpClass('path/to/a/file.php'); $myObject = $phpClass->instantiate();
If needed, you can retrieve the namespace and the class name from the file without instantiating it :
$phpClass = new PhpClass('path/to/a/file.php'); echo $phpClass->namespace(); echo $phpClass->classname();
License
Released under MIT license.