Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1.89 KB

README.md

File metadata and controls

63 lines (47 loc) · 1.89 KB

Meteoroloji Genel Müdürlüğü Hava Durumu Sınıfı (Unofficial)

Bu PHP sınıfı sayesinde www.mgm.gov.tr adresinden kolayca hava durumu bilgilerini alabilirsiniz.

Emre Yavuz tarafından PHP kullanarak yazılmıştır | github.com/emreyvz

Erişilebilen Property'ler

  • Anlık sıcaklık | getCurrentDegree()
  • Şehir Enlem Boylam Bilgileri | getLongitude() & getLatitude()
  • Gün doğumu ve günbatımı saatleri | getSunrise() & getSunset()
  • Hava Durumu (örn: sağanak yağışlı) | getCurrentCondition()
  • Hava Durumu Kodu (örn: SY) | getCurrentConditionCode()
  • Anlık Nem | getCurrentHumidity()
  • Anlık Rüzgar Hızı | getCurrentWindSpeed()
  • Anlık Basınç | getCurrentPressure()
  • Anlık Denize İndirgenmiş Basınç | getCurrentSeaLevelPressure()
  • 5 günlük tahmin | getForecast()
  • Hava Durumu ikon adresi (url) | getConditionIcon(@param)

Örnekler


Bir şehrin anlık sıcaklık değerini gösterme

$mgmWeather = new mgmWeather();
$mgmWeather->location="Ankara";
$mgmWeather->fetchData();
echo "Sıcaklık:" .$mgmWeather->getCurrentDegree();

Bir şehrin anlık rüzgar hızı değerini gösterme

$mgmWeather = new mgmWeather();
$mgmWeather->location="İstanbul";
$mgmWeather->fetchData();
echo "Rüzgar Hızı:" .$mgmWeather->getCurrentWindSpeed();

Bir şehrin 5 günlük hava tahminlerini alma

$mgmWeather = new mgmWeather();
$mgmWeather->location="İstanbul";
$mgmWeather->fetchData();
foreach ($mgmWeather->getForecast() as $day) {
  echo "Tarih: ". $day['date'] ."<br>";
  echo "En Düşük Sıcaklık: ". $day['lowestDegree']."<br>";
  echo "En Yüksek Nem Oranı: ". $day['highestHumidity'];
}

Lisans