From 2e43626d91bd76c9d8b0823679c373225b6a6d85 Mon Sep 17 00:00:00 2001 From: Ramon Caballero Date: Fri, 10 Apr 2026 11:56:29 +0100 Subject: [PATCH] Add README.md --- README.md | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d2f3c9e --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +# 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`](https://github.com/vlucas/phpdotenv) +- Strict typing enabled across the project +- Simple and extensible database connection helper +- Ready‑to‑use [PHPUnit](https://phpunit.de/) testing setup +- [PHP‑CS‑Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) configuration for consistent code style +- Clean `public/` entry point for web requests +- Fully compatible with the [PHPStarter CLI](https://ramoncaballero.dev/phpstarter-cli.git) + +## Requirements + +- PHP 8.2+ +- Composer +- Apache (or PHP's built‑in server) +- MariaDB + +## Installation + +It is recommended to use [PHPStarter CLI](https://ramoncaballero.dev/phpstarter-cli.git), 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: + +```bash +cd /var/www/sites/ +git clone https://ramoncaballero.dev/PHPStarter.git +cd +``` + +Install dependencies: + +```bash +composer install +``` + +Copy the environment file: + +```bash +sudo cp config/PHPStarter.env.example config/PHPStarter.env +``` + +Edit your environment variables as needed. + +## Directory Structure + +```bash +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: + +```bash +php -S localhost:8000 -t public +``` + +Or configure Apache manually. + +If using the [PHPStarter CLI](https://ramoncaballero.dev/phpstarter-cli.git), 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: + +```bash +./vendor/bin/phpunit +``` + +## Code Style + +Run PHP-CS-Fixer: + +```bash +./vendor/bin/php-cs-fixer fix +``` + +## License + +This project is provided as a template and may be used freely.