Browsed by
Snippet Tag: autoload

composer autoload

composer autoload

<?php require "vendor/autoload.php"; use \jsmcm\Logger\Log; use \manfred\Reader\Read; $oLog = new Log(); $oRead = new Read();

spl_autoload_register

spl_autoload_register

<?php use \jsmcm\Logger\Log; use \manfred\Reader\Read; spl_autoload_register(function($class){ $baseDirectory = __DIR__.’/src/’; $classPath = str_replace("\\", "/", $class).".php"; if (file_exists($baseDirectory.$classPath)) { require $baseDirectory.$classPath; } }); $oLog = new Log(); $oRead = new Read();