Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunsetboy/weather-forecast
A coding challenge for Scribbr
https://github.com/sunsetboy/weather-forecast
laravel php7 tdd
Last synced: about 17 hours ago
JSON representation
A coding challenge for Scribbr
- Host: GitHub
- URL: https://github.com/sunsetboy/weather-forecast
- Owner: Sunsetboy
- Created: 2020-02-24T10:07:49.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T23:09:55.000Z (over 3 years ago)
- Last Synced: 2024-11-27T22:12:52.309Z (2 months ago)
- Topics: laravel, php7, tdd
- Language: PHP
- Homepage:
- Size: 294 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Weather forecast API
![](https://travis-ci.org/Sunsetboy/weather-forecast.svg?branch=master)
[![Maintainability](https://api.codeclimate.com/v1/badges/ca33fdcf637716975db7/maintainability)](https://codeclimate.com/github/Sunsetboy/weather-forecast/maintainability)## Requirements
PHP 7.2+\
Composer## Installation
Clone repository\
Run ```composer install```\
Copy the .env.example file to .env, set up configurations in .env file## Usage
Run ```php -S localhost:8000 -t public/``` to use built-in PHP web serverTo get a forecast for today make a request:\
```GET /forecast/Amsterdam```\
or specify a date:\
```GET /forecast/Amsterdam/2020-03-01```Date should be today or up to 10 days in future
Town could be any (now the API don't has towns base and gives mocked results)You can also specify a temperature scale as a GET parameter
```GET /forecast/Amsterdam/2020-03-01?scale=fahrenheit```
Supported scales: celsius (default), fahrenheitIn case of incorrect date you will receive a response with status code 400.\
In case of correct request you will receive a response with status code 200 and a forecast in JSON format## Running tests
Without test coverage\
```vendor/bin/phpunit tests```With coverage\
```vendor/bin/phpunit tests --coverage-html tests/output/coverage```