Contracts
ModuleContract
v1.0.0Primary module contract. Extends PluginContract with routes, capabilities, and module dependencies.
Namespace
use Meteorack\Sdk\Core\Contracts\ModuleContract;How To Use It
- Reach for this surface when you need the full module contract: identity metadata plus routes, capabilities, and dependency declarations.
- In practice, extend AbstractModule instead of implementing ModuleContract directly so you inherit lifecycle defaults, SdkContext storage, and the runtime helper traits.
Methods
public function getRoutes(): arrayReturns route definitions the runtime should register for the module.
public function getCapabilities(): arrayReturns the WordPress capabilities required to access the module.
public function getRequires(): arrayReturns the slugs of other modules this module depends on.
Example
bootstrap.php
<?php
declare(strict_types=1);
use Meteorack\Sdk\RuntimeWp\AbstractModule;
class ReportsModule extends AbstractModule
{
public function getSlug(): string { return 'reports'; }
public function getName(): string { return 'Reports'; }
public function getVersion(): string { return '1.2.0'; }
public function getRoutes(): array
{
return [
['path' => '/reports', 'component' => 'reports-dashboard'],
];
}
public function getCapabilities(): array
{
return ['manage_options'];
}
public function getRequires(): array
{
return ['billing'];
}
}
return new ReportsModule();