PHPackages                             giddyeffects/yii2-yiipixu - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. giddyeffects/yii2-yiipixu

ActiveYii2-extension

giddyeffects/yii2-yiipixu
=========================

Access weather and geo data via the JSON/XML RESTful Apixu API directly in your Yii2 project

095PHP

Since Apr 5Pushed 9y agoCompare

[ Source](https://github.com/giddyeffects/yii2-yiipixu)[ Packagist](https://packagist.org/packages/giddyeffects/yii2-yiipixu)[ RSS](/packages/giddyeffects-yii2-yiipixu/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 Extension for the Apixu Weather API
========================================

[](#yii2-extension-for-the-apixu-weather-api)

Access weather and geo data via the JSON/XML RESTful Apixu API directly in your Yii2 project

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist "giddyeffects/yii2-yiipixu":"@dev"

```

or add

```
"giddyeffects/yii2-yiipixu": "@dev"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

First get an Apixu API key [here](https://www.apixu.com/signup.aspx).

Once the extension is installed, simply add the following code in your application configuration:

```
return [
    //....
    'components' => [
        //...
        'apixu' => [
            'class' => 'giddyeffects\yiipixu\Apixu',
            'api_key' => 'YOUR_APIXU_API_KEY',
        ],
    ],
];
```

You can now access the extension via \\Yii::$app-&gt;apixu;

For more details refer to the [Apixu Documentation](https://www.apixu.com/doc/). Example
----------------------------------------------------------------------------------------

[](#for-more-details-refer-to-the-apixu-documentationexample)

```
    $weather = \Yii::$app->apixu;
    $weather->query = 'Nairobi';
    $weather->request();
    if(!$weather->response->error){
        echo "Current Weather";
        echo "Location";
        echo "City: ". $weather->response->location->name;
        echo "";
        echo "Region: ".$weather->response->location->region;
        echo "";
        echo "Country: ".$weather->response->location->country;
        echo "";
        echo "Lat: ".$weather->response->location->lat." , Long:".$weather->response->location->lon;
        echo "Temperature";
        echo "";
        echo "Temperature (&deg;C): " . $weather->response->current->temp_c; echo "";
        echo "Feels like (&deg;C)". $weather->response->current->feelslike_c;
                echo "";
        echo "";
        echo "Temperature (&deg;F): " . $weather->response->current->temp_f; echo "";
        echo "Feels like (&deg;F)". $weather->response->current->feelslike_f;
        echo "";
        echo "Condition: " . $weather->response->current->condition->text;
        echo "Wind";
        echo $weather->response->current->wind_mph." mph ";
        echo $weather->response->current->wind_kph." kph ";
        echo $weather->response->current->wind_degree."&deg;  " . $weather->response->current->wind_dir."";
        echo "Humidity: ".$weather->response->current->humidity;
        echo "";
        echo "Updated On: ".$weather->response->current->last_updated."";
    }
    else {
        echo $weather->response->error->message;
    }
    $weather->api_method = 'forecast';
    $weather->query = "Mombasa";
    $weather->days = 3;
    echo "Weather forecast for the next $weather->days days for $weather->query ";
    $weather->request();
    if(!$weather->response->error){
        foreach ($weather->response->forecast->forecastday as $day) {
            echo "";
                echo "{$day->date} Sunrise: {$day->astro->sunrise}  Sunset: {$day->astro->sunset}"
                . " condition: {$day->day->condition->text} ";
                echo "&nbsp;Max.TemperatureMin.TemperatureAvg.Temperature";
                echo "&deg;C{$day->day->maxtemp_c}{$day->day->mintemp_c}{$day->day->avgtemp_c}";
                echo "&deg;F{$day->day->maxtemp_f}{$day->day->mintemp_f}{$day->day->avgtemp_f}";
                echo "Wind{$day->day->maxwind_mph}Mph  {$day->day->maxwind_kph}kph ";
                foreach ($day->hour as $hr){
                    echo "";
                    echo "";
                    echo "TimeTemperatureWindHumidity";
                    echo "{$hr->time}{$hr->temp_c}&deg;C{$hr->temp_f}&deg;F{$hr->wind_mph}Mph  {$hr->wind_kph}kph$hr->humidity";
                    echo "";
                }
            echo " ";
        }
    }
    else {
        echo $weather->response->error->message;
    }

```

Live Demo
---------

[](#live-demo)

Go to the [Interactive API Explorer](https://www.apixu.com/api-explorer.aspx) to test the API.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1635c2f3e21c415638f110ef348417610db80000bf5e4e13d63ff7b380d37333?d=identicon)[giddyeffects](/maintainers/giddyeffects)

---

Top Contributors

[![giddyeffects](https://avatars.githubusercontent.com/u/25964401?v=4)](https://github.com/giddyeffects "giddyeffects (1 commits)")

---

Tags

apixu-weather-apiyii2-extension

### Embed Badge

![Health badge](/badges/giddyeffects-yii2-yiipixu/health.svg)

```
[![Health](https://phpackages.com/badges/giddyeffects-yii2-yiipixu/health.svg)](https://phpackages.com/packages/giddyeffects-yii2-yiipixu)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
