Download the PHP package bnomei/autoloader-for-kirby without Composer
On this page you can find all versions of the php package bnomei/autoloader-for-kirby. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bnomei/autoloader-for-kirby
More information about bnomei/autoloader-for-kirby
Files in bnomei/autoloader-for-kirby
Package autoloader-for-kirby
Short Description Helper to automatically load various Kirby extensions in a plugin
License MIT
Informations about the package autoloader-for-kirby
Autoloader for Kirby
Helper to automatically load various Kirby extensions in a plugin
Installation
This package is NOT a Kirby plugin
This is a composer package because it is easier to set up and does not mess with the loading order of extensions.
- Being a package, it can also be used not only for local plugins but also as a composer dependency within plugins published online.
Autoloading of extensions
Add the autoloader for each extension type you want once, and it will correctly register all files in subfolders.
Supported Extensions
The following extensions can be autoloaded:
- [x] blueprints (php or yml, classes)
- [x] classes (php)
- [x] collections (php)
- [x] commands (php)
- [x] controllers (php)
- [x] blockModels (php)
- [x] pageModels (php)
- [x] routes (php)
- [x] api/routes (php)
- [x] userModels (php)
- [x] snippets (php)
- [x] templates (php)
- [X] translations (php or yml or json)
Notes
- Loading translations from YAML or JSON files are added by this package and is not originally part of Kirby core.
- The
classes
autoloader is very basic. It is recommended that you use a custom array with Kirby'sload()
helper or composers psr-4 autoloading. - The
routes
andapiRoutes
autoloader is based on code from @tobimori and needs a file structure similar to Next.js see examples. - Blueprints loaded from classes need the kirby-blueprints plugin
Usage
After requiring it as a dependency in either your project or plugin composer.json
you can use the autoload()
-helper to load various extension.
/site/plugins/example/index.php
Settings
The package does come with default settings to fit most usecases. But you can change them every time you call the autoloader()
-helper for a different directory (aka in each plugin index.php
-file).
/site/plugins/example/index.php
Disclaimer
This package is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.
License
It is discouraged to use this package in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.
All versions of autoloader-for-kirby with dependencies
mustangostang/spyc Version ^0.6.3
symfony/finder Version ^7.0
symfony/yaml Version ^7.0