Skip to content

Framework-less PHP Fleet Management API built with DDD, Clean Architecture, SQLite, Doctrine DBAL and full test coverage.

Notifications You must be signed in to change notification settings

Stegur/fleetcraft

Repository files navigation

FleetCraft — Fleet Management API (DDD, Clean Architecture, SQLite)

FleetCraft is a clean, framework-less PHP backend for managing vehicles, drivers, and their assignments.
The project demonstrates professional architecture using DDD, Clean Architecture, Repository Pattern, PSR standards, and SQLite as a lightweight persistent layer.

This codebase is intended as a portfolio-grade example of production-style PHP development.

Tech Stack

  • PHP 8.4+
  • SQLite
  • Doctrine DBAL
  • Doctrine Migrations
  • FastRoute
  • Pest
  • PSR-7 / PSR-17 (Nyholm)
  • PHP-DI (PSR-11)

Architecture

  • Domain — business logic (Entities, Value Objects)
  • Application — use cases / actions
  • Infrastructure — persistence (DBAL repositories)
  • Presentation — HTTP layer (PSR-7 actions)

Available make commands

Command Description
make install Install PHP dependencies
make serve Run local dev server on http://localhost:8080
make migrate Run database migrations
make migrate-generate Generate new migration class
make test Run Pest test suite
make stan Run PHPStan static analysis
make cs-fix Run PHP CS Fixer
make qa Run full QA pipeline (PHP CS Fixer + PHPStan + Tests)

Installation & Setup

1. Clone the repository

git clone https://github.com/Stegur/fleetcraft.git
cd fleetcraft

2. Install dependencies

make install

3. Create SQLite database

mkdir var
touch var/fleetcraft.sqlite

4. Run migrations

make migrate

5. Run the built-in server

make serve

API available at:

http://localhost:8080

REST API Endpoints

Health

  • GET /health

Vehicles

  • GET /vehicles
  • GET /vehicles/{id}
  • POST /vehicles
  • PUT /vehicles/{id}
  • DELETE /vehicles/{id}
  • PATCH /vehicles/{id}/odometer

Drivers

  • GET /drivers
  • GET /drivers/{id}
  • POST /drivers
  • PUT /drivers/{id}
  • DELETE /drivers/{id}

Assignments

  • GET /assignments
  • GET /assignments/{id}
  • POST /assignments
  • PATCH /assignments/{id}/complete
  • PATCH /assignments/{id}/cancel

Postman

The postman/ directory contains a ready-to-use Postman collection and environment. This allows quick manual testing without writing curl commands.

  • Import FleetCraft.postman_collection.json
  • Import FleetCraft.local_environment.json
  • Select the environment and start testing the API

Running Tests

make test

Roadmap

  • Trips (domain model)
  • Statistics / reporting
  • CQRS read models
  • GraphQL API
  • JWT authentication
  • Structured logging
  • DX improvements and DI container bindings

License

MIT

About

Framework-less PHP Fleet Management API built with DDD, Clean Architecture, SQLite, Doctrine DBAL and full test coverage.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published