diff --git a/autoload.php b/autoload.php index b750de8..9311c23 100644 --- a/autoload.php +++ b/autoload.php @@ -1,43 +1,43 @@ . /** - * Minimal autoload (without functions) + * Minimal autoload that works also without Composer! yeeh! * - * This is useful if you like creating frameworks. + * This file is useful if you like creating frameworks without Composer. * * If you love creating bots instead, see the 'autoload-with-laser-cannon.php'. */ /** * Autoload classes on-demand */ spl_autoload_register( function( $name ) { // traits have not a dedicated class, so this trick autoloads them $name = str_replace( 'Trait', '', $name ); // classes are inside directories // for example the class foo\Bar is inside path foo/Bar // the '\\' is just an escape to get the literal '\' $full_name = str_replace( '\\', '/', $name ); $path = __DIR__ . "/include/$full_name.php"; if( is_file( $path ) ) { require $path; } } ); diff --git a/composer.json b/composer.json index 9bb49ee..06a2ea6 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,16 @@ { "name": "valerio-boz/boz-mw", "description": "A wonderful PHP library for interacting with MediaWiki, Wikibase, wikitext, API, reading, writing, and even doing file uploads.", "type": "library", "license": "GNU AGPL v3+", "authors": [ { "name": "Valerio Bozzolan", "email": "nsa+gitspam@succhia.cz" } ], - "require": {} + "require": {}, + "autoload": { + "classmap": ["include"] + } }