Giter Site home page Giter Site logo

php-fut-api's Introduction

Build Status Build Status

The perfect PHP FUT API

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

Are you an EA employee?
Y: This is nothing, just leave...
N: Great! Welcome to the perfect PHP FUT API ๐Ÿ˜

How to install?

Install this project using Composer; composer require jketelaar/php-fut-api.

Then start using the API using something like:

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

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

$api = new \JKetelaar\fut\api\API('[email protected]', '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('[email protected]', '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.

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

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

Now we can get the values of the constants, by doing: ChemistryStyle::BASIC.

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

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:

findByChemistryStyle(ChemistryStyle::SNIPER())

Credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.