A PHP web application that shows current weather by city, fetches random cat facts and images, and displays the user’s location on an interactive map — all containerized with Docker for easy setup.
- Select a city to view current weather (via OpenWeatherMap API)
- Get random cat facts (from catfact.ninja API)
- Display random cat images (from cataas.com)
- Show user’s current location on a Leaflet.js map
- Dark mode toggle for comfortable viewing
- Multi-language support (English and Turkish)
- Easy deployment with Docker and Docker Compose
- PHP 8.2 with Apache
- MySQL 5.7
- Docker & Docker Compose
- Leaflet.js for maps
- OpenWeatherMap API
- catfact.ninja API
- cataas.com for cat images
-
Create a
.env
file in the project root with your environment variables:API_KEY=your_openweathermap_api_key MYSQL_ROOT_PASSWORD=xxx MYSQL_DATABASE=xxx MYSQL_USER=xxx MYSQL_PASSWORD=xxx
Note: Get your OpenWeatherMap API key from https://openweathermap.org/api.
-
Open your terminal, navigate to the project directory, and run:
docker-compose up -d
-
Access the services in your browser:
- Application: http://localhost:8080
- phpMyAdmin: http://localhost:8081
CatWeatherMap/
├── docker-compose.yml
├── .env
├── src/
│ ├── index.php
│ ├── lang/
│ ├── style.css
│ └── script.js
Make sure to add .env
to your .gitignore
file to avoid pushing sensitive data to your repository.
Feel free to fork the project, make changes, and submit pull requests!
This project is licensed under the MIT License – see the LICENSE file for details.