Skip to content

A PHP-based Weather API that fetches and returns weather data from Visual Crossing's API

Notifications You must be signed in to change notification settings

krisnaajiep/php-weather-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Weather API

A PHP-based Weather API that fetches and returns weather data from Visual Crossing's API uses predis for Redis cache and phpdotenv for loads environment variables. This project inspired by roadmap.sh.

Getting started guide

To start using the Expense Tracker API, you need to -

  1. Clone the repository.

    git clone https://github.com/krisnaajiep/php-weather-api.git
    
  2. Install dependencies.

    composer install
    
  3. Configure .env file.

    cp .env.example .env
    
  4. Configure API key and Redis connection in .env file.

    API_BASE_URL="https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/"
    API_KEY=""
    
    REDIS_HOST=127.0.0.1
    REDIS_PASSWORD=null
    REDIS_PORT=6379
    REDIS_CACHE_DB=0
    
  5. Run the PHP built-in server.

    php -S localhost:8000
    
  6. Access the endpoint with location query parameter.

    Example:

    http://localhost:8000/?location=jakarta
    

Need some help?

In case you have questions or need further assistance, you can refer to the following resources:

Releases

No releases published

Packages

No packages published

Languages