> ## Documentation Index
> Fetch the complete documentation index at: https://ownpay.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> OwnPay is licensed under AGPL-3.0 and is completely free - no licensing fees.
> Production docs URL: https://ownpay.org/docs - append .md to any page URL for clean markdown.
> OwnPay requires PHP 8.3+, MySQL/MariaDB, and Redis.
> MCP server available at https://ownpay.org/docs/mcp for programmatic documentation queries.
> Use root-relative links (e.g. /quickstart) for internal navigation - do NOT include /docs prefix.
> Plugin development: consult /developer/plugins/ pages for correct interfaces and manifests.
> Canonical locations: API auth = /api/authentication, webhook verification = /api/webhooks, rate limits = /resources/rate-limiting, transaction statuses = /fundamentals/payment-flow.
> The documentation uses the Diataxis framework: Tutorials (learning), How-to (tasks), Reference (lookup), Explanation (understanding).

# Plugin Directory Structure

> Standard directory layout for OwnPay plugins showing every file and folder with explanations of each component.

Every OwnPay plugin follows this standard directory layout. The plugin loader expects this structure when scanning the `plugins/` directory.

<Tree />

## 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](/docs/developer/plugins/manifest).

### `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-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](/docs/developer/translations).

### `assets/`

CSS and JavaScript files. Enqueue them through the `checkout.head` and `checkout.footer` action hooks:

```php theme={"theme":{"light":"github-light","dark":"github-dark"}}
$events->addAction('checkout.head', function (): void {
    echo '<link rel="stylesheet" href="' . Plugin::asset('css/plugin.css') . '">';
});
```

### `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.

## Related pages

* [Manifest reference](/docs/developer/plugins/manifest)
* [Plugin lifecycle](/docs/developer/plugins/lifecycle)
* [Hooks reference](/docs/developer/plugins/hooks)
* [Capabilities reference](/docs/developer/plugins/capabilities)


## Related topics

- [Gateway Plugin Development - Build Custom Payment Gateways](/docs/developer/plugin-types/gateway.md)
- [Plugin Manifest](/docs/developer/plugins/manifest.md)
- [Plugin System](/docs/developer/plugins/overview.md)
- [Plugin Lifecycle](/docs/developer/plugins/lifecycle.md)
- [Plugin System - Extensible Architecture](/docs/fundamentals/plugins.md)
