PHPackages                             mahmoudz/fyber-php-sdk - 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. mahmoudz/fyber-php-sdk

ActiveLibrary[API Development](/categories/api)

mahmoudz/fyber-php-sdk
======================

PHP SKD for Fyber.com

v1.0.2(9y ago)338MITPHPPHP &gt;=5.4.0

Since Aug 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Mahmoudz/fyber-php-sdk)[ Packagist](https://packagist.org/packages/mahmoudz/fyber-php-sdk)[ RSS](/packages/mahmoudz-fyber-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

PHP SDK for the Fyber.com API
=============================

[](#php-sdk-for-the-fybercom-api)

**fyber-php-sdk** is a PHP SDK for [Fyber.com](http://developer.fyber.com/content/) (the most developer friendly ad monetization platform).

fyber-php-sdk is framework agnostic PHP package that can be integrated easily with Laravel 5.

##### IMPORTANT: I am affiliated (never been) with Fyber or any of Fyber's professional associates. This project is purely my own work and carries no endorsements other than my own.

[](#important-i-am-affiliated-never-been-with-fyber-or-any-of-fybers-professional-associates-this-project-is-purely-my-own-work-and-carries-no-endorsements-other-than-my-own)

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

[](#installation)

The recommended way to install this package is via `Composer`.

#### Via Composer

[](#via-composer)

A. Run this composer command:

```
composer require mahmoudz/fyber-php-sdk:*
```

Integrations
------------

[](#integrations)

### Laravel:

[](#laravel)

The package comes bundled with a Service Provider for easier integration.

1. Register the service provider in your `config/app.php`:

```
    'providers' => array(
        ...
		mahmoudz\fyberPhpSdk\FyberPhpSdkServiceProvider::class,
    ),
```

The service provider will automatically alias the `mahmoudz\fyberPhpSdk\Fyber` class, so you can easily use the `Fyber` facade anywhere in your app.

2. Publish the configuration file:

```
php artisan vendor:publish --provider ='mahmoudz\fyberPhpSdk\FyberPhpSdkServiceProvider'
```

This will add `config/fyber-sdk.php` to your Config directory.

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

[](#configuration)

Open `config/fyber-sdk.php` and customze the package

```
    'api_key'         => 'z6ca24652116523516f2a9e5b7e02c96',

    'android_app_id'  => '11233',
    'ios_app_id'      => '22344',
    'web_app_id'      => '44566',

    'base_url'        => 'http://api.fyber.com/feed/',
    'api_version'     => '1',
    'response_format' => 'json',

    'offer_callback_token' => 'a2ca24652116523516f2a9e5b7e02cc3'),
```

Note: It's very recommended to not add your token (any sensetive data) to the config file instead reference it to a `.env` variable.

Usage
-----

[](#usage)

### Get Offers

[](#get-offers)

##### With Laravel:

[](#with-laravel)

The easiest way is to use it is by the `Fyber` facade.

```
$requiredData = [
    'uid'                                   => 1,
    'locale'                                => 'en',
    'device_id'                             => '2b6f22c904d137be2e2730235f5664094b831186',
    'os_version'                            => '4.1.2',
    'timestamp'                             => 9922774499,
    'google_ad_id'                          => 'eff26c67f527e6817b36935c54f8cc5cc5cffac2',
    'google_ad_id_limited_tracking_enabled' => '38400000-8cf0-11bd-b23e-20b96e40000d',
];

$offers = Fyber::getOffers($requiredData, 'android'); // supported: ios, web and android
```

##### General usage:

[](#general-usage)

```
// inject `mahmoudz\fyberPhpSdk\Fyber`

$offers = $fyber->getOffers($data, 'web');
```

### Validate Offers Callback

[](#validate-offers-callback)

```
// inject `mahmoudz\fyberPhpSdk\Fyber`

$isValid = $this->fyber->isValidOfferCallback($request['amount'], $request['uid'], $request['_trans_id_'], $request['sid']);

if(!$isValid){
    // return "HTTP/1.0 400 Bad Request: wrong SID"
}
```

Test
----

[](#test)

To test it from your code use the following:

```
// create real instance from Fyber
$fyber = new Fyber();

// create another instance of Fyber and mock it
$fyberMock = Mockery::mock(Fyber::class);

// now let the function getOffers call the getOffersMock instead
$fyberMock->shouldReceive('getOffers')->once()->andReturn($fyber->getOffersMock([], ''));
```

Now when your code calls `$this->fyber->getOffers($data, $appType);` it will return the content of `fyber-php-sdk/src/offers-response.json`.

Laravel friendly code sample:

```
// create real instance from Fyber
$fyber = App::make(Fyber::class);

// create another instance of Fyber and mock it
$fyberToMock = App::make(Fyber::class);
$fyberMock = Mockery::mock(fyberToMock);
App::instance(fyberToMock, $fyberMock);

// now let the function getOffers call the getOffersMock instead
$fyberMock->shouldReceive('getOffers')->once()->andReturn($fyber->getOffersMock([], ''));
```

Inject `mahmoudz\fyberPhpSdk\Fyber` anywhere in the app and get it automatically mocked, this will also return the content of `fyber-php-sdk/src/offers-response.json`.

Credits
-------

[](#credits)

- [Mahmoud Zalt](https://github.com/Mahmoudz)

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~32 days

Total

3

Last Release

3504d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28e3096ef1cc86da63cc85628e13607ea3ec844a70d7bb1b49f34d99e0b92187?d=identicon)[Mahmoudz](/maintainers/Mahmoudz)

---

Top Contributors

[![Mahmoudz](https://avatars.githubusercontent.com/u/1983984?v=4)](https://github.com/Mahmoudz "Mahmoudz (30 commits)")

---

Tags

NextPackFyberFyber SDKFyber APIFyber PHP

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mahmoudz-fyber-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/mahmoudz-fyber-php-sdk/health.svg)](https://phpackages.com/packages/mahmoudz-fyber-php-sdk)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[dymantic/laravel-instagram-feed

Fetches the instagram feed for given authenticated profiles

151157.7k](/packages/dymantic-laravel-instagram-feed)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[ivanwilliammd/satusehat-integration

Build SATUSEHAT FHIR Object in Easy Way

754.0k](/packages/ivanwilliammd-satusehat-integration)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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