Skip to main content
Every OwnPay plugin follows this standard directory layout. The plugin loader expects this structure when scanning the 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 filters
  • boot() - called after all plugins are registered
The class name must match the directory name in PascalCase: my-pluginMyPlugin.

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.
Last modified on August 25, 2026