"autoload": {
"psr-4": {
"Vendor": "src/"
},
},
<?php
//custom autoload without composer
$to_map = [
'App' => 'app/',
'Core' => 'Core/',
];
foreach($to_map as $prefix => $base_dir)
{
spl_autoload_register(function ($class) use ($prefix, $base_dir) {
$base_dir = __DIR__ . "/{$base_dir}";
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0)
{
return;
}
$relative_class = substr($class, $len);
$file = $base_dir . str_replace('', '/', $relative_class) . '.php';
if (file_exists($file))
{
require $file;
}
});
}
"autoload": {
"psr-4": {
"Portal": "src/"
}
}
Code Example |
---|
Php :: date to string in php |
Php :: PHP Max Input Vars |
Php :: php pdo select |
Php :: render vs redirect laravel exception |
Php :: laravel where update query |
Php :: php mess detector |
Php :: left join in laravel |
Php :: lumen generate app key |
Php :: install phpUnit in php by composer |
Php :: read-json-data-response-using-php |
Php :: php include and require statements |
Php :: how login with phone in laravel |
Php :: setcookie |
Php :: laravel sort collection |
Php :: make a object php |
Php :: wordpress show notice |
Php :: laravel where first |
Php :: get size files in laravel |
Php :: best pagination in laravel api with eloquent |
Php :: invalid datetime format 1292 |
Php :: check session php |
Php :: get post url from post id wordpress |
Php :: laravel wherehas with condition |
Php :: php trim string if longer than |
Php :: php foreach |
Php :: laravel custom attributes |
Php :: larave artisan command run in web |
Php :: gmdate in php |
Php :: php basename from path |
Php :: date formate in php |