Last active
September 9, 2019 00:00
-
-
Save seothemes/d2ab24023ee8ca80134077d336453cda to your computer and use it in GitHub Desktop.
Simple PSR-4 autoloader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
\spl_autoload_register( function ( $class ) { | |
if ( strpos( $class, __NAMESPACE__ ) !== false ) { | |
require_once __DIR__ . '/src' . str_replace( '\\', DIRECTORY_SEPARATOR, substr( $class, strlen( __NAMESPACE__ ) ) ) . '.php'; | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment