PHP code example of mahmoudz / fyber-php-sdk

1. Go to this page and download the library: Download mahmoudz/fyber-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mahmoudz / fyber-php-sdk example snippets


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

    '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'),


$   '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($

// inject `mahmoudz\fyberPhpSdk\Fyber`

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

// 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"
}

// 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([], ''));

// 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([], ''));
bash
composer 
bash
php artisan vendor:publish --provider ='mahmoudz\fyberPhpSdk\FyberPhpSdkServiceProvider'