A minimal, modern PHP project template that provides a clean foundation for building small to medium web applications.
Go to file Use this template
Ramon Caballero 276f5623c0 Remove placeholder password from example env file 2026-04-10 17:03:37 +01:00
bin Initialize project directory structure 2026-04-09 12:48:56 +01:00
config Remove placeholder password from example env file 2026-04-10 17:03:37 +01:00
docs Initialize project directory structure 2026-04-09 12:48:56 +01:00
public Introduce project path constants for cleaner initialization 2026-04-10 11:51:41 +01:00
src Load environment variables and establish database connection 2026-04-10 11:51:41 +01:00
templates Initialize project directory structure 2026-04-09 12:48:56 +01:00
tests Introduce project path constants for cleaner initialization 2026-04-10 11:51:41 +01:00
translations Initialize project directory structure 2026-04-09 12:48:56 +01:00
.gitignore Add PHP CS Fixer for consistent code style 2026-04-10 11:51:41 +01:00
.php-cs-fixer.dist.php Add PHP CS Fixer for consistent code style 2026-04-10 11:51:41 +01:00
README.md Fix broken links in README.md 2026-04-10 13:13:09 +01:00
composer.json Add phpdotenv for environment variable management 2026-04-10 11:51:41 +01:00
composer.lock Add phpdotenv for environment variable management 2026-04-10 11:51:41 +01:00
phpunit.xml Add PHPUnit for testing 2026-04-10 11:51:41 +01:00

README.md

PHPStarter

A minimal, modern PHP project template that provides a clean foundation for building small to medium web applications.

Features

  • PSR4 autoloading via Composer
  • Environment configuration using vlucas/phpdotenv
  • Strict typing enabled across the project
  • Simple and extensible database connection helper
  • Readytouse PHPUnit testing setup
  • PHPCSFixer configuration for consistent code style
  • Clean public/ entry point for web requests
  • Fully compatible with the PHPStarter CLI

Requirements

  • PHP 8.2+
  • Composer
  • Apache (or PHP's builtin server)
  • MariaDB

Installation

It is recommended to use PHPStarter CLI, as it automates the entire setup process and requires almost no manual configuration.

However, you can also install PHPStarter manually by following the steps below.

Clone the repository:

cd /var/www/sites/
git clone https://gitea.ramoncaballero.dev/mon/PHPStarter.git <myproject>
cd <myproject>

Install dependencies:

composer install

Copy the environment file:

sudo cp config/PHPStarter.env.example config/PHPStarter.env

Edit your environment variables as needed.

Directory Structure

PHPStarter/
    bin/                   → Executable scripts or CLI utilities
    config/                → Environment files
	docs/                  → Project documentation, guides, and reference material
    public/                → Web root; front controller (`index.php`) and public assets (css, js, icons, ...)
    src/                   → Application source code (PSR4 autoloaded)
	templates/             → Reusable HTML/PHP templates or view files
    tests/                 → PHPUnit test suites and testing utilities
	translations/          → Localization files, language packs, or message catalogs
    composer.json          → Composer package definition and autoload configuration
	composer.lock          → Locked dependency versions for reproducible installs
    phpunit.xml            → PHPUnit configuration file
	.php-cs-fixer.dist.php → Code style rules for PHP-CS-Fixer

Running the Project

Using PHP's builtin server:

php -S localhost:8000 -t public

Or configure Apache manually.

If using the PHPStarter CLI, the virtual host is created automatically.

Customization

You can safely modify:

  • Namespace (default: PHPStarter)
  • Directory structure
  • Database logic
  • Views/templates

The template is intentionally minimal to encourage flexibility.

Testing

Run PHPUnit:

./vendor/bin/phpunit

Code Style

Run PHP-CS-Fixer:

./vendor/bin/php-cs-fixer fix

License

This project is provided as a template and may be used freely.