Confronted with the ongoing challenge of locating parking spaces within our parking structures in congested city streets, we embarked on a mission to rethink the parking experience using object-oriented design principles. Create the necessary APIs to satisfy the requirements below (no frontend work required). Feel free to use your imagination when making product decisions and determining functionality, while keeping outcomes simple. We won’t be running the code (or deploying it to prod), so it doesn’t need to be perfect.
- Implement APIs for managing parking spaces
- Use object-oriented design principles
- No frontend work required
- run
sh bootstrap-loc.sh
file to initiate the project - run
docker compose exec php-fpm composer install
to install the dependencies - run
cp code/.env code/.env.local
- replace database url in
.env.local
with the following line:
DATABASE_URL="mysqli://app_user:helloworld@mysql:3306/parking_db?serverVersion=16&charset=utf8"
- run
docker compose exec php-fpm bin/console doctrine:database:create
to create the database - run
docker compose exec php-fpm bin/console doctrine:migrations:migrate --no-interaction
to run the migrations - run
docker compose exec php-fpm bin/console doctrine:fixtures:load -n
to load fixtures - run
docker compose exec php-fpm bin/phpunit tests --stop-on-failure
to run the tests (Functional and Unit)
http://localhost:8092
GET /api/parking-lot
Retrieve information about the parking lot, including the total number of spots and available spots.
POST /api/parking-spot/{id}/park
Park a vehicle in the specified parking spot.
id
: The ID of the parking spot.type
: The type of vehicle to be parked. ('car', 'van', 'motorcycle')
POST /api/parking-spot/{id}/unpark
Unpark a vehicle from the specified parking spot.
id
: The ID of the parking spot.
We welcome contributions! Read the contributing guidelines for more information.
This project is licensed under the MIT License.
For any questions or feedback, contact us at [email protected].