PHPackages                             drsdre/yii2-footballapi - 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. [API Development](/categories/api)
4. /
5. drsdre/yii2-footballapi

ActiveYii2-extension[API Development](/categories/api)

drsdre/yii2-footballapi
=======================

Yii2 Extension for football-api.com API access

0.0.1(10y ago)115BSD-3-ClausePHPPHP &gt;=5.4.0

Since Sep 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/drsdre/yii2-footballapi)[ Packagist](https://packagist.org/packages/drsdre/yii2-footballapi)[ Docs](https://github.com/drsdre/yii2-footballapi)[ RSS](/packages/drsdre-yii2-footballapi/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

Yii2-xmlsoccer
==============

[](#yii2-xmlsoccer)

Yii2 client for [Football API](http://football-api.com) API

Full API Documentation here:

Requirements:
=============

[](#requirements)

PHP5 with CURL. SimpleXML extensions only needed if XML is chosen as output.

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

[](#installation)

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

Either run

```
composer require --prefer-dist drsdre/yii2-footballapi "*"

```

or add

```
"drsdre/yii2-footballapi": "*"
```

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

Usage
-----

[](#usage)

You can either setup the client as an application component:

```
'components' => [
    'footballapiApi' => [
        'class' => '\FootballAPI\Client',
        'api_key' => 'xxx',
    ]
    ...
]
```

or use the client directly in your code:

```
$client = new \FootballAPI\Client([
    'api_key' => 'xxx',
]);
```

Configuration
-------------

[](#configuration)

The output format of the the API calls can be changed by adding a output type parameter:

```
'components' => [
    'footballApi' => [
        'class' => '\FootballAPI\Client',
        'api_key' => 'xxx',
        'output_type' => 'PHP',
    ]
    ...
]
```

Default value: JSON. Options include: XML, JSON, PHPARRAY, PHPOBJECT, LINE, CONSOLE, VAR.

Optionally a cache component can be added for example to keep the client returning data during a time-out:

```
'components' => [
    'footballApiCache' => [
        'class' => 'yii\caching\FileCache',
    ],
    'footballApi' => [
        'class' => '\FootballAPI\Client',
        'api_key' => 'xxx',
        'cache' => 'footballApiCache',
    ]
    ...
]
```

To facilitate a check to detect data changes, a content hash can be generated by setting the parameter 'generate\_hash' to true (currently only supported in XML, PHPARRAY &amp; PHPOBJECT output type). The output will then include two new attributes:

- contentHash: MD5 hash
- sourceURL: URL used to retrieve the data

If you need to have the API be executed via a specific network adapter it's possible the specify the outgoing IP:

```
$client = new \FootballAPI\Client([
    'api_key' => 'xxx',
    'service_ip' => '192.168.1.1',
]);
```

How to use API:
===============

[](#how-to-use-api)

Go to [Sign up for Free](http://football-api.com/account/membership-checkout/?level=4) and retrieve the API key for access to the football-api.com API.

Methods Available
-----------------

[](#methods-available)

Go to  for more info about methods and parameters including online testing.

Examples:
=========

[](#examples)

List competitions
-----------------

[](#list-competitions)

```
try {
	$client = new \FootballAPI\Client([
        'api_key' => 'xxx',
    ]);
	$competitions=json_decode($soccer->competitions());
	echo "Competitions List:";
	foreach($competitions as $competition){
		echo "".$competition->name." ".$competition->region."";
	}
}
catch(Exception $e) {
	echo "FootballAPI Exception: ".$e->getMessage();
}

```

If your server has multiple IP's available, you can set any IP for request:
---------------------------------------------------------------------------

[](#if-your-server-has-multiple-ips-available-you-can-set-any-ip-for-request)

```
try {
	$client = new \FootballAPI\Client([
        'api_key' => 'xxx',
    ]);
	$soccer->setRequestIp("ip_for_request");
	$result=json_decode($soccer->standings(["comp_id"=>1064]));
	var_dump($result);
}
catch(Exception $e) {
	echo "FootballAPI: ".$e->getMessage();
}

```

That's all!
-----------

[](#thats-all)

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3959d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af1ce9c639e6df7041d55842e18825a11d3864f176a9a273dfd86fca5549d7fa?d=identicon)[drsdre](/maintainers/drsdre)

---

Top Contributors

[![drsdre](https://avatars.githubusercontent.com/u/809827?v=4)](https://github.com/drsdre "drsdre (12 commits)")

---

Tags

apisoapyii2extensionconsumerlive football scoresfootball-api.com

### Embed Badge

![Health badge](/badges/drsdre-yii2-footballapi/health.svg)

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

###  Alternatives

[mongosoft/yii2-soap-client

SOAP Client Extension for Yii 2

39416.7k](/packages/mongosoft-yii2-soap-client)[conquer/services

Yii2 soap wsdl web services

1734.3k](/packages/conquer-services)[mikemadisonweb/yii2-elasticsearch

Yii2 extension for integration with Elasticsearch version 5.0 and above.

164.1k](/packages/mikemadisonweb-yii2-elasticsearch)[apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

143.5k](/packages/apexwire-yii2-restclient)

PHPackages © 2026

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