docs: add plugin development guide

This commit is contained in:
dyzulk
2026-01-18 16:46:59 +07:00
parent 53385c845e
commit d3b6d2432c
3 changed files with 166 additions and 0 deletions

View File

@@ -36,6 +36,12 @@ export const sidebarEn: DefaultTheme.Sidebar = {
{ text: 'Contribution', link: 'https://github.com/dyzulk/mivo/blob/main/CONTRIBUTING.md' },
{ text: 'Donate', link: 'https://sociabuzz.com/dyzulkdev/tribe' }
]
},
{
text: 'Development',
items: [
{ text: 'Creating Plugins', link: '/docs/guide/plugin-development' }
]
}
],
@@ -109,6 +115,12 @@ export const sidebarId: DefaultTheme.Sidebar = {
{ text: 'Kontribusi', link: 'https://github.com/dyzulk/mivo/blob/main/CONTRIBUTING.md' },
{ text: 'Donasi', link: 'https://sociabuzz.com/dyzulkdev/tribe' }
]
},
{
text: 'Pengembangan',
items: [
{ text: 'Membuat Plugin', link: '/id/docs/guide/plugin-development' }
]
}
],

View File

@@ -0,0 +1,77 @@
# Plugin Development Guide
Mivo supports a modular plugin system that allows developers to extend functionality, add themes, or integrate third-party services. This guide details the rules and structure required for your plugin to work with Mivo and appear in the Registry.
## Directory Structure
A valid Mivo plugin must have a flat structure with a `plugin.php` file in the root.
```text
plugin-name/
├── plugin.php # (Required) Entry point & Metadata
├── composer.json # (Optional) Dependencies
├── README.md # (Required) Documentation for Registry
├── theme/ # (Optional) Captive Portal theme files
│ └── styles.css
└── src/ # (Optional) PHP Classes
```
## Metadata Header
Your `plugin.php` **must** start with a specific comment block. The Registry crawler uses this to categorize and display your plugin.
```php
<?php
/**
* Plugin Name: My Awesome Plugin
* Description: Adds a dark mode toggle to the hotspot login page.
* Version: 1.0.0
* Author: YourName
* Category: Hotspot Tools
* Tags: theme, dark-mode, ui
* Core Version: >=1.2.0
*/
use App\Services\Hook;
// Plugin logic starts here...
```
### Required Fields
- **Plugin Name**: Displayed title.
- **Description**: Short summary (max 160 chars).
- **Version**: SemVer format (e.g., `1.0.0`).
- **Category**: One of: `Hotspot Tools`, `System Tools`, `Payment Gateway`, `Reports`.
- **Tags**: Comma-separated search keywords.
## Release & Registry Rules
To get your plugin listed in the [Official Registry](/plugins/):
1. **Public Repository**: Host your code on GitHub.
2. **Naming**: Repository name should start with `plugin-` (e.g., `plugin-advanced-login`).
3. **Versioning**: Use **Git Tags** for releases. The Registry strictly prefers tagged releases over the main branch.
- Tag format: `v1.0.0`.
- You can use GitHub Actions to auto-generate ZIPs.
4. **Documentation**: A comprehensive `README.md` is mandatory. It will be mirrored to the Mivo website.
## Sample GitHub Workflow
Create `.github/workflows/release.yml` to automatically package your plugin:
```yaml
name: Release Plugin
on:
push:
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: zip -r plugin.zip . -x "*.git*"
- uses: softprops/action-gh-release@v1
with:
files: plugin.zip
```

View File

@@ -0,0 +1,77 @@
# Panduan Pengembangan Plugin
Mivo mendukung sistem plugin modular yang memungkinkan pengembang memperluas fungsionalitas, menambahkan tema, atau mengintegrasikan layanan pihak ketiga. Panduan ini menjelaskan aturan dan struktur yang diperlukan agar plugin Anda berjalan di Mivo dan muncul di Registry.
## Struktur Direktori
Plugin Mivo yang valid harus memiliki struktur datar dengan file `plugin.php` di root.
```text
plugin-name/
├── plugin.php # (Wajib) Entry point & Metadata
├── composer.json # (Opsional) Dependensi
├── README.md # (Wajib) Dokumentasi untuk Registry
├── theme/ # (Opsional) File tema Captive Portal
│ └── styles.css
└── src/ # (Opsional) Class PHP
```
## Header Metadata
File `plugin.php` Anda **wajib** dimulai dengan blok komentar khusus. Crawler Registry menggunakan data ini untuk mengategorikan plugin Anda.
```php
<?php
/**
* Plugin Name: My Awesome Plugin
* Description: Menambahkan fitur mode gelap ke halaman login hotspot.
* Version: 1.0.0
* Author: NamaAnda
* Category: Hotspot Tools
* Tags: theme, dark-mode, ui
* Core Version: >=1.2.0
*/
use App\Services\Hook;
// Logika plugin dimulai di sini...
```
### Kolom Wajib
- **Plugin Name**: Nama yang ditampilkan.
- **Description**: Ringkasan pendek (maks 160 karakter).
- **Version**: Format SemVer (contoh: `1.0.0`).
- **Category**: Salah satu dari: `Hotspot Tools`, `System Tools`, `Payment Gateway`, `Reports`.
- **Tags**: Kata kunci pencarian (dipisahkan koma).
## Aturan Rilis & Registry
Agar plugin Anda terdaftar di [Registry Resmi](/id/plugins/):
1. **Repository Publik**: Simpan kode Anda di GitHub.
2. **Penamaan**: Nama repo sebaiknya diawali dengan `plugin-` (contoh: `plugin-advanced-login`).
3. **Versioning**: Gunakan **Git Tags** untuk rilis. Registry memprioritaskan rilis bertag daripada main branch.
- Format tag: `v1.0.0`.
- Gunakan GitHub Actions untuk membuat ZIP otomatis.
4. **Dokumentasi**: File `README.md` wajib ada. Isinya akan di-mirror ke website Mivo.
## Contoh GitHub Workflow
Buat file `.github/workflows/release.yml` untuk memaketkan plugin otomatis:
```yaml
name: Release Plugin
on:
push:
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: zip -r plugin.zip . -x "*.git*"
- uses: softprops/action-gh-release@v1
with:
files: plugin.zip
```