Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# Database Configuration
# These environment variables override values in config/config.ini
# Use format: SECTION_KEY (e.g., DATABASE_HOST, DATABASE_USERNAME, etc.)
#
# For Docker Compose, these are set automatically
# For local development, set these as needed to override config.ini

# Database settings
DATABASE_HOST=127.0.0.1
DATABASE_PORT=3306
DATABASE_DATABASE=f1_db
DATABASE_USERNAME=root
DATABASE_PASSWORD=
DATABASE_CHARSET=utf8mb4
DATABASE_COLLATION=utf8mb4_general_ci
DATABASE_DRIVER=mysql

# Application settings
APP_NAME="F1 Management API"
APP_ENV=development
APP_DEBUG=true

# Log settings
LOG_LEVEL=debug
LOG_PATH=logs/app.log
LOG_CHANNEL=app
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- staging/**
- feature/**
paths-ignore:
- README.md
push:
Expand Down
3 changes: 1 addition & 2 deletions .idea/I425-Team-Project.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 13 additions & 22 deletions DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,40 +72,31 @@ Xdebug is configured in the container. Configure your IDE:

### Environment Variables

Configuration is managed via `/config/config.ini` file (created from `config.ini.example`):

```ini
[database]
host = mariadb
port = 3306
database = f1_db
username = f1_user
password = f1_password

[app]
env = development
debug = true
```
Configuration is managed via `.env` file at the project root:

**For Docker Compose**: Environment variables override config.ini values
**For Docker Compose**:
```env
DATABASE_HOST=mariadb
DATABASE_PORT=3306
DATABASE_DATABASE=f1_db
DATABASE_USERNAME=f1_user
DATABASE_PASSWORD=f1_password
APP_ENV=development
APP_DEBUG=true
```

**For local XAMPP development** (without Docker), update `/config/config.ini`:
```ini
[database]
host = 127.0.0.1
username = root
password =
**For local XAMPP development** (without Docker):
```env
DATABASE_HOST=127.0.0.1
DATABASE_PORT=3306
DATABASE_DATABASE=f1_db
DATABASE_USERNAME=root
DATABASE_PASSWORD=
APP_ENV=development
APP_DEBUG=true
```

The `Config` class (`config/config.php`) loads settings with environment variables taking precedence.
The `Config` class (`config/config.php`) loads settings from `.env` file using strongly-typed configuration classes. See `CONFIG_MIGRATION.md` for detailed documentation.

## Composer

Expand Down
File renamed without changes.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ Pages: [F1 Management API Documentation](https://jvspeed74.github.io/PHP-RESTful
Ideally this project should be run in a Docker container, but due to time constraints, it was not fully implemented. May
be added in the future.

#### Configuration:

This project uses `.env` files for configuration with strongly-typed configuration classes. See [CONFIG_MIGRATION.md](CONFIG_MIGRATION.md) for details.

1. **Dependencies:** Install PHP dependencies using `composer install`.
2. **Database:**
2. **Configuration:**
* Copy `.env.example` to `.env`: `cp .env.example .env`
* Update `.env` with your database and application settings
3. **Database:**
* Set up a MariaDB instance.
* Import the schema from `f1_db.sql`.
* Configure database connection details (typically via environment variables or a configuration file - not detailed
in provided context).
3. **Running the Application:**
* Configure database connection in `.env` file
4. **Running the Application:**
* The application can be served using a local PHP development server (e.g., `php -S localhost:8000 -t public`).
4. **Running Tests:**
5. **Running Tests:**
* Unit tests: `vendor/bin/pest`
* Integration tests: Requires a running application and database. Configure Newman with the appropriate environment
variables and run the Postman collection.
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"license": "MIT",
"autoload": {
"psr-4": {
"App\\": "src/"
"App\\": "src/",
"Config\\": "config/"
}
},
"authors": [
Expand All @@ -32,7 +33,8 @@
"slim/http": "1.4.0",
"monolog/monolog": "3.7.0",
"illuminate/pagination": "v11.30.0",
"firebase/php-jwt": "6.10"
"firebase/php-jwt": "6.10",
"vlucas/phpdotenv": "^5.6"
},
"require-dev": {
"phpstan/phpstan": "2.0.1",
Expand Down
Loading