Skip to content
Documentation

Memeh Web Engine (PHP MVVM)

The Web Engine is an optional runtime that helps you ship production websites and portals in PHP hosting environments while keeping your frontend in real HTML/CSS/JS. The deployment package is tuned for institutional portals: structured content, explicit ViewModels, maintainable templates, and controlled public delivery.

Overview

A simple runtime for real frontends

The Web Engine helps teams that want the simplicity of “drop-in hosting” without giving up control over layout. You build the frontend. MemehCMS stays the content hub behind it.

MVVM, not magic
Controllers build explicit ViewModels. Templates stay clean and predictable.
Your HTML stays yours
Commented HTML templates render your markup with small placeholder tags.
WordPress-like content types
The deployment package includes pages, news, and a services/products catalogue with archive and detail views.
Service portal ready
Each service/product item can define a fee plus an action CTA that links to an internal page or external payment/application portal.
Starter kit quickstart

Download, run, customize, connect

The starter kit is intentionally explicit. A developer can run it from local content first, then connect it to MemehCMS APIs when the tenant content is ready.

# 1. Unzip the package
# 2. Open a terminal inside the starter folder
php -S localhost:8083 -t public_html public_html/router.php

# 3. Open the site
http://localhost:8083
Edit first
content/site.php, content/home.php, content/services.php, resources/views/*.html, and public_html/assets/css/app.css.
Connect API
Set MEMEH_API_BASE, MEMEH_TENANT_ID, MEMEH_PRIMARY_MENU_LOCATION, and MEMEH_FOOTER_MENU_LOCATION.
Keep tenant scoped
Leave require_tenant_id enabled so public websites cannot accidentally render another tenant's content.
Deploy safely
Point hosting to public_html, keep security headers on, and never expose config, local content files, or stack traces publicly.
Replace WordPress safely
Bring media into MemehCMS first. Large WordPress libraries can be imported as year/month ZIPs. On the same cPanel/SiteGround hosting, keep public_html/wp-content/uploads only as a temporary bridge when old media URLs must remain live.
Why it exists

Because production hosting realities vary

Regulated institutions often have different hosting constraints, approval processes, and support capacity. The Web Engine gives teams a production-capable PHP delivery path today, while keeping the option to evolve the frontend or consume MemehCMS APIs directly.

Best fit

Shared hosting, simple VPS deployments, quick rollouts, and teams who want clean HTML output with a stable rendering flow.

Request flow

Controller → ViewModel → HTML View

Keep controllers thin. Make ViewModels explicit. Render clean, commented HTML views. That’s the whole philosophy.

GET /services

routes/web.php
  → ServiceController@index

ServiceController
  → $vm = ServiceIndexViewModel::make(...)
  → View::render('service-index', $vm)

resources/views/layout.html
  → {{> partials/header }}
  → {{{ content }}}
  → {{> partials/footer }}
Folder structure

A predictable layout teams can learn fast

Keep the runtime boring and stable. Put your creativity in the frontend templates and assets.

app/
  Controllers/
  ViewModels/
  Services/
resources/
  views/
    layouts/
    pages/
    partials/
public/
  assets/
content/
  pages.php
  news.php
  services.php
routes/
  web.php
public/
  index.php
Templates

Layouts, pages, partials — clean and reusable

Use a base layout for your header/footer and shared UI. Use pages for route-level templates. Use partials for reusable components (cards, lists, navigation).

Layouts
Your global shell: head, header, footer, scripts, main container.
Partials
Reusable slices: hero blocks, list items, CTA bars, navigation.
Services/products
A production content pattern for service portals, ecommerce-like catalogues, fees, and CTA flows such as Apply, Pay fee, Book, or Buy.
ViewModels

ViewModels are your contract

Don’t push raw API responses straight into templates. ViewModels reshape data into a stable, template-friendly structure. This keeps themes maintainable and avoids accidental coupling.

// Example ViewModel output (plain array)
[
  "pageTitle" => "Services",
  "items" => [
    [
      "title" => "Permit Application",
      "detailUrl" => "/services/permit-application",
      "ctaLabel" => "Pay fee",
      "ctaUrl" => "https://payments.example.gov.sl/permit-application",
    ],
    [
      "title" => "Digital Service Package",
      "detailUrl" => "/services/digital-service-package",
      "ctaLabel" => "Buy package",
      "ctaUrl" => "/pages/contact",
    ],
  ],
]
MemehCMS APIs

Fetch content from MemehCMS, then render your UI

The Web Engine is headless-first: your ViewModels fetch content from MemehCMS endpoints and map it into your templates.

GET /api/articles?tenant_id={tenant_uuid}&per_page=10&include=feature
GET /api/services?tenant_id={tenant_uuid}
GET /api/pages/{slug}?tenant_id={tenant_uuid}
GET /api/sliders?tenant_id={tenant_uuid}&placement=home
GET /api/menus/by-location/primary?tenant_id={tenant_uuid}
Public modules

Articles, pages, services, sliders, emergency alerts, departments, locations, library items, FAQs, leadership, publications, menus, media, and accessibility settings.

Admin-only modules

Implementation requests, complaints, FOI requests, support messages, request cases, audit logs, and admin notes stay inside MemehCMS.

Deployment

Choose what’s practical

MemehCMS doesn’t force one deployment path. Pick what your team can support.

Consume APIs directly
React/Vue/Laravel/anything. Full frontend freedom.
Use Web Engine
Simple PHP hosting environments and fast rollouts.
Static export
Publish HTML/CSS/JS for maximum simplicity.
Developer pool and marketplace

Verification first, public selling second

Developer Pool is the private verification pipeline. Marketplace is the public Fiverr-style platform for approved sellers and gigs.

Developer Pool:
Apply -> Super admin review -> Verified provider -> Eligible for marketplace

Marketplace:
Approved seller -> Published gig -> Starter/Standard/Premium packages -> Buyer enquiry
Next steps

What to do next

1) Download the deployment package
Skim the folder structure, routes, and one example page.
2) Build one page end-to-end
Controller → ViewModel → commented HTML template.
3) Map content cleanly
Keep ViewModels stable; don’t leak raw API into templates.
4) Ship your first rollout
Then expand across institutions, branches, and brands.

Want us to implement your first portal?

Bring your design. We’ll ship the first implementation and set your team up to scale across institutions, branches, and brands.