[Composer package] to autload extensions in plugins

I created a little helper to speed up writing plugins. It can be used locally or for public composer based plugins.

composer require bnomei/autoloader-for-kirby

/site/plugins/example/index.php

<?php

// optionally change some settings
/*
autoloader(__DIR__, [
    'snippets' => [
        'folder' => 'schnippschnapp',
    ],
]);
*/

autoloader(__DIR__)->classes();
// use a different folder
// autoloader(__DIR__)->classes('src');

Kirby::plugin('bnomei/example', [
    'options' => [
        // options
    ],
    'blueprints' => autoloader(__DIR__)->blueprints(),
    'collections' => autoloader(__DIR__)->collections(),
    'controllers' => autoloader(__DIR__)->controllers(),
    'pageModels' => autoloader(__DIR__)->pageModels(),
    'userModels' => autoloader(__DIR__)->userModels(),
    'snippets' => autoloader(__DIR__)->snippets(),
    'templates' => autoloader(__DIR__)->templates(),
    'translations' => autoloader(__DIR__)->translations(),
    // other extensions
]);