Skip to content

jabaltorres/web-fun

Repository files navigation

WebFun

Custom PHP CMS-style sandbox built around records, contacts, users, and a small admin area. The app uses Composer for PHP dependencies, Twig for templating, MySQL/MariaDB for storage, and a Gulp pipeline for frontend assets.

This repository is currently a hybrid codebase:

  • The main entrypoint is public/index.php.
  • Core services and controllers live under src/.
  • Some pages are routed through src/Routes/web.php.
  • Many user/contact/record flows still exist as direct legacy scripts under public/.

What It Includes

  • Record listing/search and record CRUD pages
  • Contact management pages
  • User login and profile/admin-related pages
  • Admin dashboard/settings flow
  • Twig-based page rendering alongside PHP view templates
  • Sass, JS bundling, BrowserSync, and image optimization via Gulp

Tech Stack

  • PHP 8.1
  • MariaDB/MySQL
  • Twig 3
  • Dotenv
  • Bootstrap 4.6
  • jQuery 3.7
  • Gulp
  • DDEV for local development

Local Development

The practical local setup for this repo is DDEV. The checked-in DDEV config uses:

  • PHP 8.1
  • MariaDB 10.11
  • public/ as the docroot
  • project URL https://web-fun.ddev.site

Prerequisites

  • DDEV
  • Docker/OrbStack
  • Node.js/npm
  • Composer

Start The Project

  1. Install PHP dependencies:
composer install
  1. Install frontend dependencies:
npm install
  1. Start DDEV:
ddev start
  1. Import the sample database dump if you need local data:
ddev import-db --src=db.sql
  1. Open the site:
ddev launch

Or visit https://web-fun.ddev.site.

Environment Variables

The app reads configuration from a root .env file via vlucas/phpdotenv.

At minimum, the code expects these keys:

  • DB_SERVER
  • DB_USER
  • DB_PASS
  • DB_NAME
  • SITE_OWNER
  • SITE_AUTHOR
  • SITE_NAME
  • SITE_TAGLINE
  • SITE_DESCRIPTION

Optional but used by some flows:

  • APP_ENV
  • POSTMARK_API_TOKEN
  • MAIL_FROM_ADDRESS

Frontend Assets

The asset pipeline is driven by gulpfile.js.

Useful commands:

npx gulp

Runs the default task: cleans generated CSS, rebuilds styles/scripts, and starts BrowserSync against https://web-fun.ddev.site/.

npx gulp style

Builds Sass into public/assets/css.

npx gulp scripts

Lints and rebuilds frontend JS bundles.

npx gulp imageminify

Optimizes images in public/assets/images.

Database

This project does not use framework migrations or php artisan.

  • The checked-in schema/data snapshot is db.sql.
  • To export the current DDEV database:
ddev exec mysqldump -u root -proot db > db.sql

Project Structure

config/          bootstrap and app wiring
public/          webroot and legacy PHP endpoints
src/Controllers  controllers
src/Core         router, helpers, validation, database classes
src/Models       domain models
src/Routes       route definitions
src/Services     business logic/services
src/Views        PHP and Twig views/templates
public/assets/   Sass, JS, generated CSS, images

Current State

This is not a full framework app and the routing migration is not complete yet.

  • public/index.php bootstraps the app and hands requests to the custom router.
  • Only a subset of routes are currently defined in src/Routes/web.php.
  • Several features still rely on direct script endpoints such as public/users/login.php and public/contacts/index.php.

That means local development and debugging should assume a mixed routed/legacy application, not a finished centralized MVC/router setup.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors