Examples

Learn by studying these example plugins included with PteroCA.

hello-world Plugin

Location: plugins/hello-world/

Purpose: Demonstrates all plugin capabilities

Key Files to Study

  • plugin.json - Complete manifest with all options

  • Bootstrap.php - Initialization and cleanup

  • src/Controller/HelloController.php - Routes and controllers

  • src/Widget/HelloWidget.php - Dashboard widget

  • src/EventSubscriber/MenuEventSubscriber.php - Menu customization

  • src/Tab/ExampleTab.php - Server tab

  • src/Command/GreetCommand.php - CLI command

  • src/CronTask/ExampleTask.php - Scheduled task

  • Migrations/Version.php* - Database setup

What It Demonstrates

  • All 7 capabilities (routes, entities, migrations, ui, eda, console, cron)

  • Service registration patterns

  • Asset publishing

  • Translations

  • Event handling

  • CRUD controller integration

Features Showcase

1. Dashboard Widget

Displays a simple greeting on the dashboard with configurable message.

2. Custom Route

Simple controller that renders a page.

3. Console Command

CLI command to greet users.

4. Cron Task

Example scheduled task.

paypal-payment Plugin

Location: plugins/paypal-payment/

Purpose: Real-world payment provider integration

Key Files to Study

  • src/Provider/PayPalPaymentProvider.php - Payment provider implementation

  • src/Adapter/PayPalAdapter.php - SDK wrapper (adapter pattern)

  • composer.json - External dependencies

  • src/Controller/WebhookController.php - Webhook handling

What It Demonstrates

  • Payment provider interface

  • External SDK integration

  • Adapter pattern for isolating external dependencies

  • Webhook security and handling

  • Settings management for API credentials

  • Error handling and logging

Features Showcase

1. Payment Provider

Implementation of PaymentProviderInterface.

2. Adapter Pattern

Wraps PayPal SDK to isolate external dependency.

3. Webhook Handling

Secure webhook endpoint.

Creating Your Own Example

Minimal Plugin Structure

Minimal plugin.json

Minimal Controller

Minimal Template

Learning Path

1. Start with hello-world

Study the complete example to understand all capabilities.

2. Create a Simple Plugin

Build a basic plugin with just routes and templates.

3. Add Database

Add entities and migrations.

4. Implement Widgets

Create dashboard widgets.

5. Add Cron Tasks

Implement scheduled automation.

6. Study paypal-payment

Learn payment provider integration if needed.

7. Build Your Plugin

Apply everything you've learned to your own plugin idea.

Common Plugin Ideas

Analytics Plugin

Track and display statistics:

  • Page views

  • User activity

  • Server usage

  • Custom metrics

Capabilities needed: routes, entities, migrations, ui, cron

Backup Plugin

Automated backups:

  • Database backups

  • File backups

  • Cloud storage integration

  • Scheduled backups

Capabilities needed: console, cron, entities

Discord Integration

Sync with Discord:

  • User role sync

  • Notifications

  • Commands via webhook

  • Server status display

Capabilities needed: routes, entities, cron

Referral System

Reward user referrals:

  • Referral tracking

  • Bonus credits

  • Leaderboard

  • Statistics

Capabilities needed: routes, entities, migrations, ui, eda

Ticket System

Support ticket management:

  • Create/manage tickets

  • Email notifications

  • Status tracking

  • Admin interface

Capabilities needed: routes, entities, migrations, ui, eda

Getting Help

Resources

  • Official Docs: https://docs.pteroca.com/for-developers/

  • Discord: https://discord.com/invite/Gz5phhuZym

  • GitHub: https://github.com/PteroCA-Org/panel

Community Examples

Check GitHub for community-created plugins:

  • Search for "pteroca-plugin" topic

  • Study popular plugins

  • Ask in Discord for recommendations

Last updated