forked from mike42/escpos-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoload.php
26 lines (24 loc) · 804 Bytes
/
autoload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/**
* Users who do not have 'composer' to manage dependencies, include this
* file to provide auto-loading of the classes in this library.
*/
spl_autoload_register ( function ($class) {
/*
* PSR-4 autoloader, based on PHP Framework Interop Group snippet (Under MIT License.)
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
*/
$prefix = "Mike42\\";
$base_dir = __DIR__ . "/src/Mike42/";
/* Only continue for classes in this namespace */
$len = strlen ( $prefix );
if (strncmp ( $prefix, $class, $len ) !== 0) {
return;
}
/* Require the file if it exists */
$relative_class = substr ( $class, $len );
$file = $base_dir . str_replace ( '\\', '/', $relative_class ) . '.php';
if (file_exists ( $file )) {
require $file;
}
} );