zendframework/zend-loader
Autoloading and class loading utilities for Zend Framework applications. Provides standard and optimized autoloaders (including PSR-0/PSR-4 style support), plugin class loading, and tools to resolve and map class names to files for legacy or modular codebases.
This package provides PSR-0 and class-map based autoloading utilities for legacy Zend Framework (ZF1/ZF2) code. Since it's archived (last release: 2019-09-04) and superseded by laminas/laminas-loader and modern PSR-4/PSR-12 standards, its primary use today is maintaining very old Laravel applications that originated from ZF1/ZF2 migrations. To get started:
Zend_Loader or Zend\Loader classes (e.g., in vendor/zendframework/zend-loader/).config/app.php, look for legacy classmap or files includes referencing Zend_Loader::loadClass().Zend_Loader::loadClass('My_Class_Name') where PSR-4 autoloading doesn’t apply.⚠️ Do not use in new Laravel apps. Prefer
Illuminate\Support\Composeror Composer’s native PSR-4 autoloading.
use Zend\Loader\StandardAutoloader;
use Laravel\SerializableClosure\SerializableClosure;
// In AppServiceProvider::boot()
$loader = new StandardAutoloader([
StandardAutoloader::LOAD_NS => ['LegacyApp' => base_path('app/Legacy')],
]);
$loader->register();
Zend\Loader\ClassMapAutoloader during bootstrap (e.g., in bootstrap/app.php):
$autoloader = new ClassMapAutoloader([
base_path('app/legacy_classes_map.php'),
]);
$autoloader->register();
composer dump-autoload --classmap-authoritative, then gradually migrate to PSR-4 in composer.json.zendframework/zend-loader package relies on deprecated spl_autoload_register() behavior; it may conflict with Laravel’s Composer-managed autoloader. Always run composer dump-autoload after modifications.My_Class vs MyClass). Ensure filenames match class names exactly.Zend_ prefix naming. Prefer moving these to app/Legacy with PSR-4 and deprecating Zend_Loader entirely.Zend\Loader\StandardAutoloader::autoload() in a custom wrapper to log missing classes and ease migration:
class MigrationAutoloader extends StandardAutoloader
{
public function autoload($class)
{
if ($class === 'Legacy\UnusedComponent') {
logger()->warning('Legacy component accessed: ' . $class);
}
return parent::autoload($class);
}
}
How can I help you explore Laravel packages today?