Webiik allows you to use extensions. Extensions are reusable parts of Webiik application.
composer create-project webiik/extension Extension
⚠️ Code of every extension has to live in its own namespace beginning with letters WE, followed by name of extension folder. For example:
WE\Admin\Controller
WE\Admin\Middleware
WE\Admin\Model
WE\Admin\Component
WE\Admin\Trait
Unlike the main Webiik application, extensions have some limitations:
It doesn’t mean your extension can’t use services or access configuration. If your extension requires some specific service or configuration, you have to add it manually in the main application. These limitations are here to prevent conflicts between extensions and the main application.
To enable the extension, you have to register it within your main application.
$app->run();
add the following line:
$app->use('Admin', '/admin');
The first parameter is the name of extension folder inside private/extensions folder, the second parameter is URI of extension within your main application.
"autoload": {
"psr-4": {
"WE\\Admin\\Controller\\": "extensions/Admin/code/controllers",
"WE\\Admin\\Middleware\\": "extensions/Admin/code/middleware",
"WE\\Admin\\Model\\": "extensions/Admin/code/models",
"WE\\Admin\\Trait\\": "extensions/Admin/code/traits"
},
"classmap": ["extensions/Admin/code/components"]
}