Plugin-SDK: Oberflächen für Kunden-Plugins, Generator, Doku (0.20.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m46s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m49s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m8s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m51s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m29s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m12s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m11s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m33s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-27 04:57:28 +00:00
parent 46b7b05f94
commit ea2200cb3e
353 changed files with 2151 additions and 1542 deletions

View file

@ -0,0 +1,19 @@
<?php
namespace {{namespace}}\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
class IndexController extends Controller
{
public function __invoke(Request $request): Response
{
// „{{slug}}::Index“ → resources/js/pages/Index.vue dieses Plugins
return Inertia::render('{{slug}}::Index', [
'greeting' => 'Hallo '.($request->user()->first_name ?: $request->user()->name).'!',
]);
}
}

13
sdk/stubs/Hello.vue.stub Normal file
View file

@ -0,0 +1,13 @@
<script setup>
import { Panel } from '@inhaus/ui';
defineProps({
name: { type: String, required: true },
});
</script>
<template>
<Panel title="{{name}}" action-label="Öffnen" action-href="/{{slug}}">
<p class="ih:text-sm">Hallo {{ name }} – diese Kachel kommt aus dem Plugin „{{name}}“.</p>
</Panel>
</template>

26
sdk/stubs/Index.vue.stub Normal file
View file

@ -0,0 +1,26 @@
<script setup>
import { ref } from 'vue';
import { AppLayout, Button, PageHeader, Panel, toast } from '@inhaus/ui';
defineProps({
greeting: { type: String, required: true },
});
const clicks = ref(0);
</script>
<template>
<AppLayout title="{{name}}">
<PageHeader title="{{name}}" description="Ein Plugin, gebaut mit dem Inhaus-Plugin-SDK." />
<div class="ih:grid ih:gap-6 ih:lg:grid-cols-2">
<Panel :title="greeting">
<p class="ih:text-sm ih:text-muted-foreground">
Diese Seite liegt in <code>resources/js/pages/Index.vue</code>. Bausteine wie Panel, Button oder
PageHeader kommen aus <code>@inhaus/ui</code> – Farben und Ecken folgen dem Erscheinungsbild.
</p>
<Button class="ih:mt-4" @click="clicks++; toast.success(`Schon ${clicks}× geklickt`)">Klick mich</Button>
</Panel>
</div>
</AppLayout>
</template>

30
sdk/stubs/Plugin.php.stub Normal file
View file

@ -0,0 +1,30 @@
<?php
namespace {{namespace}};
use App\Dashboard\Widgets;
use App\Models\User;
use App\Plugins\Plugin;
use App\Support\Navigation;
/**
* {{name}}
*
* register(): Menüpunkte, Kacheln, Rechte, Blöcke anmelden (läuft bei jedem Aufruf).
* boot(): nach dem Laden aller Plugins – z. B. Hooks, geplante Aufgaben.
* Routen (routes/web.php) und Migrationen (database/migrations) lädt das Portal selbst.
* Mehr dazu: docs/PLUGINS.md im Portal.
*/
class {{studly}}Plugin extends Plugin
{
public function register(): void
{
// Menüpunkt im Portal („Mehr“ bzw. unter „Menü“ im Backend frei anordenbar)
$this->app->make(Navigation::class)->add('{{slug}}', '{{name}}', '/{{slug}}', active: '{{slug}}.*', sort: 80);
// Kachel auf der Startseite – Vue-Komponente resources/js/widgets/Hello.vue
$this->app->make(Widgets::class)->add('{{slug}}.hello', '{{slug}}::Hello', 'aside', sort: 90,
props: fn (User $user) => ['name' => $user->first_name ?: $user->name],
label: '{{name}}: Hallo-Kachel');
}
}

27
sdk/stubs/README.md.stub Normal file
View file

@ -0,0 +1,27 @@
# {{name}}
Inhaus-Plugin, erzeugt mit `php artisan inhaus:make-plugin`.
## Entwickeln
```bash
npm install
npm run build # Oberfläche nach dist/ bauen
npm run package # ZIP zum Hochladen erzeugen
```
Das Plugin liegt dafür am besten direkt unter `plugins/{{slug}}` einer Entwicklungsinstallation
des Portals; nach `npm run build` die Seite neu laden.
## Aufbau
- `plugin.json` – Name, Version, Voraussetzungen
- `src/{{studly}}Plugin.php` – Menüpunkt, Kachel, Rechte (Registries des Portals)
- `routes/web.php`, `src/Http/Controllers/` – Seiten
- `resources/js/pages/` – Inertia-Seiten (`{{slug}}::Name`)
- `resources/js/widgets/`, `blocks/`, `profile/`, `profile-panels/`, `editorial/` – Kacheln, Pagebuilder-Blöcke, Profil- und Redaktionsbereiche
- `resources/css/style.css` – Tailwind mit den Design-Tokens des Portals
- `inhaus-sdk/` – Build-Voreinstellung (Kopie aus dem Portal, Version {{coreVersion}})
Oberflächen importieren `vue`, `@inertiajs/vue3` und `@inhaus/ui` – das Portal stellt
sie zur Laufzeit bereit. Übersicht der Bausteine und Registries: `docs/PLUGINS.md` im Portal.

View file

@ -0,0 +1,17 @@
{
"name": "inhaus-plugin-{{slug}}",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite build --watch",
"package": "vite build && php bin/package"
},
"devDependencies": {
"@tailwindcss/vite": "{{v_tailwind_vite}}",
"@vitejs/plugin-vue": "{{v_plugin_vue}}",
"tailwindcss": "{{v_tailwind}}",
"vite": "{{v_vite}}",
"vue": "{{v_vue}}"
}
}

29
sdk/stubs/package.stub Normal file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
/**
* Baut {{slug}}-<version>.zip zum Hochladen unter Administration → Plugins.
* Enthält alles außer Quelltexten fürs Frontend-Build und node_modules.
*/
$root = dirname(__DIR__);
$manifest = json_decode(file_get_contents("{$root}/plugin.json"), true);
$target = "{$root}/{{slug}}-{$manifest['version']}.zip";
$skip = ['node_modules', '.git', 'inhaus-sdk', 'package.json', 'package-lock.json', 'vite.config.js', basename($target)];
@unlink($target);
$zip = new ZipArchive;
$zip->open($target, ZipArchive::CREATE);
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS));
foreach ($files as $file) {
$relative = substr($file->getPathname(), strlen($root) + 1);
if (in_array(explode(DIRECTORY_SEPARATOR, $relative)[0], $skip, true) || str_ends_with($relative, '.zip')) {
continue;
}
$zip->addFile($file->getPathname(), '{{slug}}/'.$relative);
}
$zip->close();
echo "Paket: {$target}\n";

View file

@ -0,0 +1,13 @@
{
"slug": "{{slug}}",
"name": "{{name}}",
"version": "1.0.0",
"description": "{{description}}",
"author": "{{author}}",
"namespace": "{{namespaceJson}}\\",
"class": "{{namespaceJson}}\\{{studly}}Plugin",
"requires": {
"core": ">={{coreVersion}}",
"php": ">=8.3"
}
}

3
sdk/stubs/style.css.stub Normal file
View file

@ -0,0 +1,3 @@
/* Tailwind mit den Design-Tokens des Portals – Klassen mit Präfix „ih:“, z. B. ih:bg-brand, ih:text-muted-foreground, ih:rounded-lg */
@import "../../inhaus-sdk/theme.css";
@source "../js";

View file

@ -0,0 +1,5 @@
import { defineConfig } from 'vite';
import { inhausPlugin } from './inhaus-sdk/vite.js';
// Baut resources/js/{pages,widgets,blocks,…} nach dist/ (siehe inhaus-sdk/vite.js)
export default defineConfig(inhausPlugin());

8
sdk/stubs/web.php.stub Normal file
View file

@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
use {{namespace}}\Http\Controllers\IndexController;
Route::middleware('auth')->prefix('{{slug}}')->name('{{slug}}.')->group(function () {
Route::get('/', IndexController::class)->name('index');
});