The php-shared-hosting extension transforms your irgen definitions into a fully-functional PHP backend. It supports MySQL/PDO-based REST APIs, dynamic routing via .htaccess, and simultaneous hosting of multiple React SPAs.

Hybrid App Architecture

A 'Hybrid App' on irgen combines a high-performance public blog with custom internal business tools. You can use the Multi-DSL (Split DSL) pattern to separate your backend logic from your UI definitions.

1// 1. backend.dsl.ts (Logic & Data)
2import { app } from "irgen";
3app("MyBackend", (t) => {
4  t.meta("php-shared-hosting", { /* ... */ });
5  t.entity("Ticket", (e) => { e.model({ status: "string" }); e.list(); });
6});
7
8// 2. ui.dsl.ts (Interface)
9import { frontend } from "irgen";
10import { adminPreset, appPreset } from "irgen-ext-php-shared-hosting";
11frontend("admin", (f) => adminPreset()(f));
12frontend("app", (f) => appPreset()(f));

Presets

The extension provides powerful presets to jumpstart your development. - adminPreset: Generates a professional Post-Management and User-Management dashboard. - appPreset: Configures a React app to automatically bind to the generated PHP REST API.

Multi-SPA Routing

The generated .htaccess automatically handles routing for all registered frontend applications. For example, visits to /admin go to the Admin UI, /app go to the User App, and all other paths serve the public blog.

CLI Usage

1irgen backend.dsl.ts ui.dsl.ts --ext=irgen-ext-php-shared-hosting --targets=frontend,php-shared-hosting