Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚗 Car Reservation API

A clean and modular Symfony API for managing car reservations.

📦 Tech Stack

  • PHP 8.2+
  • Symfony 6+
  • Doctrine ORM
  • MySQL / PostgreSQL (your choice)
  • Composer

🚀 Getting Started

1. Clone the repository

git clone https://github.com/your-username/car-reservation-api.git
cd car-reservation-api

2. Install dependencies

composer install

🔌 API Endpoints

1. Car

Basic CRUD operations for car management.

i. Create Car

  • URL: [POST] /car
  • Description: Create a new car.
  • Request Body (JSON):
{
    "brand": "Mercedes",
    "licensePlate": "0214 TBH",
    "model": "SLR"
}
  • Response (201 CREATED):
{
  "id": 6,
  "licensePlate": "0214 TBH",
  "brand": "Mercedes",
  "model": "SLR2"
}

ii. Delete Car

  • URL: [DELETE] /car/{id}
  • Description: Delete a car by ID.
  • Response (204 NO-CONTENT)

iii. List all Car

  • URL: [Get] /car
  • Description: Get all cars in a list.
  • Response (200 OK): List of cars in the database.

iii. Get Car

  • URL: [Get] /car/{id}
  • Description: Get a car by ID.
  • Response (200 OK): Car information.

2. Reservation

i. Create Reservation

  • URL: [POST] /reservation
  • Description: Create a new reservation.
  • Request Body (JSON):
{
  "carId": 3,
  "userEmail": "alice@example.com",
  "startTime": "2025-04-20T10:00:00",
  "endTime": "2025-04-20T14:00:00"
}
  • Response (201 CREATED):
{
  "id": 6,
  "carId": 4,
  "carModel": "SLR",
  "carLicensePlate": "0214 TBH",
  "carBrand": "Mercedes",
  "userEmail": "alice@example.com",
  "startTime": {
    "date": "2025-04-20 13:00:00.000000",
    "timezone_type": 3,
    "timezone": "UTC"
  },
  "endTime": {
    "date": "2025-04-20 14:00:00.000000",
    "timezone_type": 3,
    "timezone": "UTC"
  }
}

ii. Delete Reservation

  • URL: [DELETE] /reservation/{id}
  • Description: Delete a reservation by ID.
  • Response (204 NO-CONTENT)

iii. List all Reservation

  • URL: [Get] /reservation
  • Description: Get all reservations in a list.
  • Response (200 OK): List of reservations in the database.

iii. Get Reservation

  • URL: [Get] /reservation/{id}
  • Description: Get a reservation by ID.
  • Response (200 OK): Reservation information.

About

A clean and modular Symfony API for managing car reservations.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages