A modern, containerized (Docker support) PHP application template featuring Vite bundling, PostgreSQL, Nginx, and automated deployment to GitHub Pages.
Key features:
- Modern
Vitebundling system withPHPintegration - Modular JavaScript (
ES Modules) - CSS Preprocessing (
SCSS) - Task Automation with
Make - Automated build processes and task runners
- Hot Module Replacement (
HMR) support - Automatic Reloading for Development (PHP & Frontend)
- Seamless Dependency Management (Composer for PHP, npm for Node.js)
- Flexible Environment-based Configuration (
.envfiles) - Containerized development workflow (
Nginx,PHP-FPM,PostgreSQL,Vite Dev Server) - Optimized Docker Images (
Multi-Stage Builds) - Optimized static site generation
- Page Speed Optimization
SEOOptimizationAccessibility(A11y) Enhancements- Responsive Image Handling (preparation and adaptive serving,
Sharpfor image processing) - Local Image Caching
- Device-based Triggers (mobile/tablet/desktop)
- Semi-Automated GitHub Pages Deployment
- Database migrations with
Phinx - Caching with
APCu
Tech Stack:
- Frontend:
JavaScriptHTML5CSS3SCSS - Build & Style:
VitenpmMakeAutopreloadSharpNode.js - Template Engine:
PHP - Backend Tools:
NginxPHP-FPMComposerPostgreSQLPhinxAPCu - DevOps:
DockerGitHub PagesGit - Documentation:
MarkdownPHPDocJSDoc
-
master- Production branch containing the latest stable version
- All feature branches are created from here
- Receives only tested and approved changes
-
dev- Development branch for feature integration
- All new features are merged here first
- Synced with
masterafter testing
-
gh-pages- Deployment branch for GitHub Pages
- Submodule in
/publicdirectory - Contains only built static files
- Automatically served at ashuksu.github.io/warriors
- Updated manually via a deployment script
- More details
-
archive/OLD-DESIGN-v1- Historical snapshot of the original website design
- Tagged as tag
v1.7.0 - NEVER merged into active branches
- More details
-
feature/WRRS-task- New features (e.g.,feature/WRRS-nginx) -
bugfix/WRRS-task- Bug fixes (e.g.,bugfix/WRRS-routing) -
experiment/[API]- Experimental features (e.g.,experiment/WGET)
Get your development environment up and running in just a few steps.
Prerequisites:
- Docker Desktop installed and running.
1. Clone the Repository
git clone https://github.com/ashuksu/warriors.git
cd warriors2. Create Environment File
This command copies the example environment file. Review .env and adjust variables if needed.
make envSee More details for environment variable setup. See More details for all available environment variables and settings.
3. Start the Development Environment
This single command builds necessary Docker images, installs all dependencies (Composer & NPM) inside the containers,
and starts Nginx, PHP-FPM, PostgreSQL, and Vite Dev Server.
make uprecommendations
Use
make dev ARGS="list of arguments"for more control over thedocker-composecommand in development mode. Example:make dev ARGS="up --build -d"
# For first time setup or after changes in Dockerfile or docker-compose.yml, use building without cache:
make dev ARGS="build --no-cache"Your development environment is now running!
- Web Application: localhost served by Nginx, proxying to PHP-FPM and Vite Dev Server.
- Vite Dev Server: localhost:5173 for HMR and direct asset serving.
After
make upyou need to install Composer dependencies and build NPM assets inside the containers.
Sources
- See More details for detailed instructions on Docker setup.
- See More details for detailed instructions on Vite setup.
Use the Makefile as your primary tool for managing the project. All commands are run from your host machine.
- Start everything:
make up - Stop everything:
make down
You never need to install PHP, Composer, or Node.js on your host machine. Use these commands to run tools inside their respective containers:
- Run any Composer command:
# For installing Composer dependencies
make composer installrecommendations
# For apdating dependencies after changes in `composer.json` you can use:
make composer update
make composer dump-autoload# Example: require a new PHP package
make composer require phpleague/flysystem- Run any NPM command:
# For building NPM assets
make npm buildrecommendations
# Example: install a new JS package
make npm install dayjs- Open a shell in the PHP container:
make exec-php- Open a shell in the Vite helper container:
make exec-vite- Monitor Docker containers (requires
ctopimage):
make monitorThe development environment includes a PostgreSQL database and uses Phinx for database migrations.
- Apply new database migrations:
make migrate- Run the database seeding script to populate the database with initial data:
make seedrecommendations
Use
make create-migration [...name]for creating a new migration (use CamelCase format). Example:make create-migration name=NewPageMigration
make create-migration name=MigrationNameThe IS_DEV variable controls environment-specific settings.
Our application now leverages Dependency Injection (DI) containers for managing services and configuration variables, ensuring better organization and testability.
Running in Development Mode (.env):
DOMAIN=localhost
VITE_DEV_SERVER=http://localhost:5173/
IS_DEV=trueRunning in Production Mode (configured in docker-compose.yml for php service):
DOMAIN=domain.example.com
IS_DEV=false(This overrides any IS_DEV value in .env for production deployments)
To stop the development environment:
make downTo stop the production environment:
make down-prodTo completely remove all project-specific containers, networks, and persistent data volumes (node_modules cache,
database data, etc.), run:
make cleanWarning! Purge ALL Docker system resources (containers, images, volumes, cache). USE WITH EXTREME CAUTION! This command removes all Docker resources on your system, not just project-specific ones. It will ask for confirmation.
make destroy1. Build Production Images This command executes a multi-stage Docker build, creating lean, self-contained images with all frontend assets and PHP dependencies included.
make build-prod2. Build Frontend Assets for Local Processing If you need to build frontend assets locally (e.g., for specific deployment pipelines not using the Docker build stage for assets), run:
make npm run build3. Run in Production Mode
This command starts the production services (Nginx, PHP-FPM, and PostgreSQL) in detached (background) mode.
make up-prodSee Deployment Guide for detailed instructions on:
- Production build process
- GitHub Pages deployment
- Static site generation
⬆️ Back to Top