|
|
||
|---|---|---|
| bin | ||
| config | ||
| docs | ||
| public | ||
| src | ||
| templates | ||
| tests | ||
| translations | ||
| .gitignore | ||
| .php-cs-fixer.dist.php | ||
| README.md | ||
| composer.json | ||
| composer.lock | ||
| phpunit.xml | ||
README.md
PHPStarter
A minimal, modern PHP project template that provides a clean foundation for building small to medium web applications.
Features
- PSR‑4 autoloading via Composer
- Environment configuration using
vlucas/phpdotenv - Strict typing enabled across the project
- Simple and extensible database connection helper
- Ready‑to‑use PHPUnit testing setup
- PHP‑CS‑Fixer 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 built‑in 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 (PSR‑4 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 built‑in 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.