πŸ“¦ PhPstrap β€” Project Structure Guide

A practical map of the folders and files that make up PhPstrap. This reflects the v0.1.3 changes: Bootstrap 5 defaults, a unified Admin Updater, and a single source of truth for versioning.

πŸ—‚οΈ Root (/)

  • index.php β€” Front controller / landing page.
  • install.php β€” Setup wizard entry point (Requirements β†’ DB β†’ Admin β†’ Modules β†’ Config β†’ Done).
  • .htaccess β€” Web server rules (friendly URLs, basic hardening). Updater can skip this by default.
  • robots.txt β€” Crawl hints for search engines.
  • maintenance.php β€” Optional maintenance page template.
  • LICENSE, README.md β€” Project license and documentation.
  • backups/ β€” Auto-created by the Updater before installs (safe to keep outside web root if possible).
  • cache/
    • updates/ β€” Temporary ZIPs and extracted update trees used by the Updater.
  • uploads/ β€” User-generated uploads (keep writable; never commit secrets here).
  • logs/ β€” App/admin logs, rotation hints; protected via .htaccess.

πŸ”§ /admin/

  • dashboard.php β€” Admin overview.
  • update.php β€” New unified Updater (Download β†’ Preview β†’ Install), with backups and safe skip lists. Reads config/version.php first, falls back to DB.
  • users.php, invites.php, logs.php β€” User/admin management and logs.
  • settings.php β€” Site & module settings UI.
  • login.php / logout.php β€” Admin auth endpoints.
  • includes/
    • admin-auth.php β€” Admin session guard (require admin).
    • admin-sidebar.php β€” Sidebar renderer used across admin pages.

🧱 /includes/

  • settings.php β€” Get/set helpers for the settings table.
  • modules.php β€” Module bootstrap & hook runner.
  • header.php, footer.php, nav.php β€” Layout partials.
  • header-scripts.php, footer-scripts.php β€” JS/CSS includes.

πŸ› οΈ /installer/

  • requirements.php β€” PHP version & extension checks.
  • database.php β€” Connection + schema install (with safe fallbacks).
  • config.php β€” Writes core configs and helper files.
  • ui.php β€” Updated installer UI (BS5) with step indicator; footer now reads version.php.

πŸ“Š /dashboard/

  • index.php β€” User-facing dashboard (post-login, if used).

🎨 /assets/

  • css/ β€” Bootstrap 5 & custom styles (e.g., admin.css, dashboard.css, homepage.css).
  • js/ β€” bootstrap.bundle.min.js and app scripts.
  • img/ β€” Static images, logos, icons.

πŸ—ƒοΈ /config/

  • app.php β€” App initialization (sessions, timezone, guardrails).
  • database.php β€” PDO connection factory (reads install values).
  • version.php β€” Single source of truth: PHPSTRAP_NAME, PHPSTRAP_VERSION, PHPSTRAP_BUILD. Read by installer and updater.
  • functions.php β€” Common utilities (if present).

🧩 /modules/

  • Each module lives in its own folder, e.g. /modules/hcaptcha/, /modules/smtp/, /modules/analytics/.
  • module.json β€” Metadata + default settings (written by installer when selected).
  • [name].php β€” Module class; can register hooks such as form_captcha or send_email.
  • Optional docs (e.g. README.md, provider templates).

🌐 /lang/

  • lang_en.php β€” Base language strings (generated by installer).

🧩 Legacy / compatibility

  • /css/ β€” Legacy stylesheet location used in early builds. Prefer /assets/css/ going forward.

πŸ” File Safety & Updates

  • The Updater makes a timestamped backup in /backups/ before installing.
  • By default it skips sensitive paths: config/, uploads/, logs/, cache/, .git/, .github/, installer/, plus files like config/database.php, config/app.php, index.php, .htaccess. You can opt-in to β€œAllow core overwrites” if needed.
  • Version shown in Admin is read from config/version.php, with a DB fallback.

πŸ“Œ Recommended Permissions

  • Directories: 755
  • Files: 644
  • Writable by PHP (hosting-dependent): /uploads, /logs, /cache, /backups

Questions or ideas? Open an issue on GitHub.