Do autoloading without composer
All checks were successful
timw4mail/php-kilo/pipeline/head This commit looks good
All checks were successful
timw4mail/php-kilo/pipeline/head This commit looks good
This commit is contained in:
parent
26ea12883a
commit
dd4b707d12
25
kilo
25
kilo
@ -3,7 +3,30 @@
|
|||||||
|
|
||||||
namespace Aviat\Kilo;
|
namespace Aviat\Kilo;
|
||||||
|
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/src/constants.php';
|
||||||
|
require_once __DIR__ . '/src/config.php';
|
||||||
|
require_once __DIR__ . '/src/functions.php';
|
||||||
|
|
||||||
|
// Remove the composer install requirement by
|
||||||
|
// manually handling autoloading
|
||||||
|
spl_autoload_register(function (string $class) {
|
||||||
|
$nsParts = explode('\\', $class);
|
||||||
|
array_shift($nsParts);
|
||||||
|
array_shift($nsParts);
|
||||||
|
|
||||||
|
array_unshift($nsParts, __DIR__, 'src');
|
||||||
|
$file = implode(DIRECTORY_SEPARATOR, $nsParts) . '.php';
|
||||||
|
|
||||||
|
if (file_exists($file))
|
||||||
|
{
|
||||||
|
require_once($file);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Log notices/errors/warnings to file
|
// Log notices/errors/warnings to file
|
||||||
set_error_handler(static function (
|
set_error_handler(static function (
|
||||||
|
Loading…
Reference in New Issue
Block a user