2017 © Pedro Peláez
 

library php-fut-api

Allows you to interact with the FUT using PHP

image

jketelaar/php-fut-api

Allows you to interact with the FUT using PHP

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 9 Open issues
  • 16 Versions
  • 4 % Grown

The README.md

Build Status Build Status, (*1)

The perfect PHP FUT API

This is a perfect FUT AP...
No wait, let's first answer a question., (*2)

Are you an EA employee?
Y: This is nothing, just leave...
N: Great! Welcome to the perfect PHP FUT API :smirk:, (*3)

How to install?

Install this project using Composer; composer require jketelaar/php-fut-api., (*4)

Then start using the API using something like:, (*5)

<?php
require_once('vendor/autoload.php');

define('DATA_DIR', __DIR__ . '/data/');

$api = new \JKetelaar\fut\api\API('your@email.me', 'password', 'secret', 'totp_callback', 'platform');

// You can also disable the SSL verify peer, when you're having issues with your environment. Simply pass true as the latest parameter
// $api = new \JKetelaar\fut\api\API('your@email.me', 'password', 'secret', 'totp_callback', 'platform', true); 

if($api->login() === true) {
    echo('We\'re logged in!' . "\n");

    $handler = $api->getHandler();
    foreach($handler->getTradepile() as $trade) {
        // Interact with $trade here
    }
}

function totp_callback() {
    $totp = new \OTPHP\TOTP('FIFA', 'SECRET');

    return $totp->now();
}

FAQ

How do the enum(eration)s work?

As you might have seen, we're using an implemententation of php-enum, so we could provide enumerations within classes and type hinting.
An example of this is the class ChemistryStyle., (*6)

With a few constants, you can access the variables, but also use them for type hinting.
Let's say you have:, (*7)

class ChemistryStyle extends Enum  {
    const BASIC = 250;
    const SNIPER = 251;
}

Now we can get the values of the constants, by doing: ChemistryStyle::BASIC., (*8)

But in a more advanced level, we can also use these for type hinting, using parenthesises.
Say we have the function:, (*9)

function findByChemistryStyle(ChemistryStyle $style){
    echo('Searching for players with style ID' . $style);
}

As you can see, we have a parameter, which only allows ChemistryStyle.
We can call this function using the constant and adding an opening-and-closing parenthesis:, (*10)

findByChemistryStyle(ChemistryStyle::SNIPER())

Credits

The Versions

19/05 2017
19/03 2017
16/03 2017
27/01 2017
09/01 2017
09/01 2017
12/10 2016