π¦ 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.phpfirst, 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
settingstable. - 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.jsand 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_captchaorsend_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 likeconfig/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.