plugins/ directory.
Core files
manifest.json
Required. Contains the plugin name, slug, version, type, capabilities, and other metadata. The plugin loader reads this first. See the full Manifest reference.
Plugin.php
Required. The entry point. Must implement OwnPay\Plugin\PluginInterface with these methods:
register(EventManager $events, Container $container)- register hooks and filtersboot()- called after all plugins are registered
my-plugin → MyPlugin.
Optional directories
config/
Default configuration values. The plugin manager reads these and stores overrides in the database. Access via Plugin::config('my-plugin').
src/
Your plugin’s PHP classes. The plugin loader adds this directory to the autoloader. Organize by responsibility: services, controllers, models.
resources/views/
Twig templates used by your plugin. Admin settings pages, custom dashboards, and report views live here.
resources/lang/
Language files for plugin UI strings. Each file is keyed by language code (en.json, bn.json). See Translations.
assets/
CSS and JavaScript files. Enqueue them through the checkout.head and checkout.footer action hooks:
migrations/
Database migration files. Each file defines an up() and down() method. Migrations run automatically on activation and reverse on uninstall. They execute within a transaction.
routes/
Custom API and web route definitions. Requires the api_routes capability. Routes are scoped to the plugin’s slug to avoid conflicts.