PHP code example of refatbd / free-fire-php

1. Go to this page and download the library: Download refatbd/free-fire-php 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/ */

    

refatbd / free-fire-php example snippets


use Refatbd\FreeFire\FreeFireFactory;
use Refatbd\FreeFire\Protocol\BuiltInProtocolProfiles;

$profile = BuiltInProtocolProfiles::get(getenv('FREEFIRE_PROTOCOL') ?: 'OB54');
$client = FreeFireFactory::make(
    __DIR__.'/storage/freefire-cache',
    profile: $profile,
);

$player = $client->player('4422076728', 'BD');

$media = FreeFireFactory::makeMedia(
    __DIR__.'/storage/freefire-cache',
    __DIR__.'/storage/freefire-tmp',
    profile: $profile,
);

$avatar = $media->avatar($player);
file_put_contents(__DIR__.'/public/avatar.webp', $avatar->data);
bash
composer