A modular, multilingual PHP website toolkit with a Vite-powered frontend build.
WebkitProBasic is a code-first project for building server-rendered websites from reusable PHP components. Pages are assembled with PHP includes; component styling and behavior are maintained alongside each component and compiled with Vite, Sass, JavaScript, and TypeScript. The example website provides German and English routes, a component showcase, Light/Dark Mode, and SEO metadata.
Project status: A working example/starter architecture under active development, not a packaged framework, CMS, or production-hardened application. The repository contains demonstration content and configuration that must be reviewed before deployment.
- WebkitProBasic
- Author
- Server-side page rendering using PHP templates and component includes.
- 7 component directories, including three navigation variants, galleries, sliders, tabs, accordions, and other UI elements.
- Component-local SCSS and optional JavaScript/TypeScript files, discovered automatically by Vite through
import.meta.glob. - German and English page trees (
de/anden/) with clean URLs via Apache rewrite rules. - SEO configuration for page metadata, canonical URLs, language alternatives, Open Graph/Twitter tags, and JSON-LD.
- No client-side SPA framework required; Node.js is used during frontend development/build, not to serve PHP requests.
| Layer | Implementation |
|---|---|
| Server rendering | PHP; header.php, footer.php, language-specific pages and component templates |
| HTTP / clean URLs | Apache with mod_rewrite and root .htaccess |
| Frontend | HTML, SCSS/Sass, JavaScript; TypeScript-ready component entry points |
| Bundling | Vite 8 (vite.config.ts, src/main.ts) |
- An Apache-compatible PHP environment with
.htaccessoverrides andmod_rewriteenabled. - Node.js and npm versions supported by the installed Vite release; consult Vite's current engine requirements and use a compatible modern Node release.
-
Clone the repository and install frontend and PHP dependencies:
git clone https://github.com/heimdall3010/WebkitProBasic.git cd WebkitProBasic npm install -
Generate the asset bundle and Vite manifest:
npm run build:dev
-
Serve the repository root as an Apache web root (or VirtualHost document root). Ensure Apache rewrite rules and
.htaccessprocessing are enabled. The current.htaccessassumes the application is hosted at/, rather than an arbitrary subdirectory. -
Open the site using Apache, for example
http://localhost/en/homeorhttp://localhost/de/start. The root route redirects to the English homepage. -
For continuous frontend rebuilds during development, use a second terminal:
npm run dev
Important:
npm run devis a Vite build in watch mode, not Vite's development server. Refresh the PHP-served page to see the rebuilt files. Do not expect a Vite HMR endpoint at port 5173. -
Switch to
dev-mode = trueinvariable_global.php -
Comment out
#RewriteBase /in.htaccess
| Command | Behavior |
|---|---|
npm run dev |
vite build --mode development --watch |
npm run watch |
Alias for the same watch build |
npm run build:dev |
One-off development-mode build |
npm run build |
Production-mode bundle to dist/ |
npm run preview |
Vite preview for generated frontend assets; not a replacement for the Apache/PHP server |
npm run audit |
npm dependency audit |
php/variables_global.php contains $dev_mode for PHP base-URL behavior. It does not start Vite or recompile assets. Configure it for your hosting environment independently of the npm build mode.
.
├── .htaccess # Clean URLs, language rewrites, fallback redirects
├── components/ # Reusable PHP components; component-local SCSS/JS/TS
│ ├── accordion/
│ ├── nav/
│ └── ... # See component reference below
├── de/ # German page templates
├── en/ # English page templates
├── dist/ # Vite-generated production/development bundle
│ ├── .vite/manifest.json
│ └── assets/
├── header.php # Globals, SEO and manifest-based assets, page opening
├── footer.php # Shared page footer and global widgets
├── index.php # Placeholder; homepage handled by Apache rewrite
├── misc/ # Favicon/logo sets, SVGs, images, video, SEO media
├── php/
│ ├── variables_global.php # Site identity, language, blog mode and base URL
│ └── variables_seo.php # Page metadata and structured-data inputs
├── src/main.ts # Vite import-glob entry point
├── style/ # Global SCSS and Sass partials
├── vite.config.ts # Vite build output and manifest config
└── package.json
dist/ contains generated artifacts and ignored by Git. A fresh installation/build remains the preferred setup.
- Apache maps a clean route such as
/en/hometo its PHP page via.htaccess. - The language-specific page includes
header.php, which loads global configuration and SEO metadata. header.phpreadsdist/.vite/manifest.json, locates thesrc/main.tsentry, and emits its compiled CSS and JavaScript references.- The page includes the desired PHP component templates, sometimes loading a
*_content.phpfile first to set content arrays. footer.phprenders shared footer UI and global components.
There is no general-purpose PHP router class or automatic component registration. Routing is primarily Apache rewrite rules, with explicit PHP includes for page composition.
src/main.ts automatically imports:
- Top-level
style/*.{scss,sass}files, excluding underscore-prefixed Sass partials. - Every immediate
components/*/style.{scss,sass}file. - Every immediate
components/*/script.{ts,js}file.
Vite bundles those imports into dist/ and generates a manifest containing hashed asset paths. header.php uses that manifest, rather than hard-coded output filenames.
Consequences: New component-level style.scss, style.sass, script.js, or script.ts files are picked up on a rebuild without editing a central import list. The discovery patterns are one component-directory level deep; nested styles/scripts are not picked up automatically unless imported by an entry file. Code still has to be compatible with global execution on pages where the component may be absent.
Site-wide styles live in style/; individual styles live beside the corresponding PHP component. style/_vars.scss is a Sass partial, so it must be included explicitly with @use/@forward where needed rather than expected to compile as an independent entry.
See en/home.php and de/start.php for complete working examples. Many components require their content file to be included before their view:
<?php
include __DIR__ . '/../components/accordion/accordion_content.php';
include __DIR__ . '/../components/accordion/accordion.php';
?>The component view may depend on variables initialized by the content include and on $lang from php/variables_global.php. Component APIs are currently conventions rather than a standardized public interface.
components/exampleCard/
├── exampleCard.php # PHP markup
├── exampleCard_content.php # Optional localized content/configuration
├── style.scss # Optional; discovered by Vite
└── script.ts # Optional; discovered by Vite
Include the PHP view in a page, add styles and behavior as needed, and run npm run dev or npm run build. A TypeScript file is supported by the Vite glob; existing components still largely use JavaScript. Guard DOM lookups in scripts because component modules are included globally, not only when a particular PHP component appears on the current page.
The following 7 directories exist in components/ in the supplied snapshot. Names reflect folder/API names and are case-sensitive on typical Linux servers.
| Component | Purpose |
|---|---|
accordion |
Collapsible content sections ![]() |
calloutParallax |
Parallax-style callout sections |
heroFat |
Hero section ![]() |
heroSlim |
Compact hero section preview |
tabs |
Tabbed content presentation ![]() |
nav |
Full navigation with desktop/mobile variants. In this navigation uses the library Hamburgers by Jonathan Suh. , ![]() |
The directory list is an inventory, not a guarantee that each component has a complete isolated API, tests, accessibility verification, or production readiness. Some previews from the original README no longer exist at their documented paths, so only verified image paths are linked here.
de/contains German pages;en/contains English pages.- The
.htaccessrules map clean URLs to matching PHP files and add alangquery parameter for/de/and/en/routes when missing. php/variables_global.phpchooses the current language from the query string, session, or fallback (de); individual components commonly branch on$langto select localized PHP arrays.- The
/route currently redirects to/en/home?lang=en. - Language-switch navigation is implemented inside the navigation components; language equivalents require maintenance when routes change.
- Languages can be added, by keeping the structure and editing the
.htaccess,variables_global,variables_seo.
The routing implementation is specific to Apache, and currently includes redirects to 404 pages rather than consistently returning an HTTP 404 status. If installing in a subdirectory or using Nginx, the rules and base URLs must be adapted.
php/variables_global.php: site name/contact information, social links, language selection,$dev_mode, sidebar toggle, and blog connection mode.php/variables_seo.php: metadata for pages and blog posts, alternate-language slugs, Open Graph images, canonical data and schema types.header.php: emits metadata and JSON-LD structured data using these variables, plus the Vite asset references.misc/: favicons, logos, SVG icons, media and SEO images.
Search indexing is currently disabled: header.php outputs a broad robots meta directive containing noindex, nofollow. Remove or adjust this deliberately for any public site meant to appear in search results. Review dynamic metadata/JSON-LD and canonical URL construction before going live.
SEO
Entry-specific SEO information is separately configured in php/variables_seo.php. Blog content changes may therefore require SEO mapping updates.
- Install pinned dependency
install npmand runnpm run build. - Deploy the PHP pages, components, configuration, public static assets and
dist/includingdist/.vite/manifest.json. Do not publish.env, source maps with secrets, backup archives, or maintenance/admin utilities by accident. - Configure Apache with
mod_rewrite,.htaccesssupport and the appropriate virtual-host root. - Set the correct
$dev_modeand site settings inphp/variables_global.php; review SEO and contact form configuration. - Test both languages, assets, clean URLs, missing routes, and response status codes on the actual hosting environment.
header.php throws a runtime exception if the Vite manifest is missing, unreadable, or lacks the src/main.ts entry. Always build frontend assets before serving the PHP pages.
Development by Deniz Inan.




