Skip to content

Commit 5001d7e

Browse files
committed
restored autoloader file
1 parent 5a04ad9 commit 5001d7e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This package is installable and autoloadable via Composer as [embed/embed](https
3333
$ composer require embed/embed
3434
```
3535

36-
If you cannot (or don't want to) use composer, a [PSR-4](https://packagist.org/search/?tags=PSR-4) loader is needed.
36+
If you cannot (or don't want to) use composer, just include the [PSR-4 autoload.php file](src/autoloader.php) in your code.
3737

3838
## Usage
3939

src/autoloader.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
spl_autoload_register(function ($class) {
4+
if (strpos($class, 'Embed\\') !== 0) {
5+
return;
6+
}
7+
8+
$file = __DIR__.str_replace('\\', DIRECTORY_SEPARATOR, substr($class, strlen('Embed'))).'.php';
9+
10+
if (is_file($file)) {
11+
require_once $file;
12+
}
13+
});

0 commit comments

Comments
 (0)