PHP Classes

File: src/Utils/loader.php

Recommend this page to a friend!
  Classes of Matheusz Maydana   Webhook Deploy   src/Utils/loader.php   Download  
File: src/Utils/loader.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Webhook Deploy
Webhook handler to update projects from GitHub
Author: By
Last change:
Date: 18 days ago
Size: 424 bytes
 

Contents

Class file image Download
<?php

namespace App\Utils;

spl_autoload_register(function ($class) {

   
$prefix = 'App\\';

   
$base_dir = __DIR__ . '/../../src/';

   
$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_once
$file;
    }
});