elreco/laravelfortnite

This package is abandoned and no longer maintained. No replacement package was suggested.

Fortnite API for Laravel

dev-master 2019-08-23 14:43 UTC

This package is auto-updated.

Last update: 2020-02-23 15:58:34 UTC


README

StyleCI License Monthly Downloads

This is a Fortnite API provider for Laravel using FortniteAPI.com. You can get user wins, kills, the latest news, fortnite server status and many more with this API.

Thanks to samhoogantink for the PHP code.

Installation

Via Composer

$ composer require elreco/laravelfortnite

In your Laravel project root directory

Usage

  1. Add 'Elreco\LaravelFortnite\LaravelFortnite' to your Controller file
<?php

namespace App\Http\Controllers;

use App\User;
use App\Http\Controllers\Controller;
use Elreco\LaravelFortnite\LaravelFortnite;
[...]
?>
  1. Init a new LaravelFortnite object and set your api Key. You can have a key by registering on FortniteAPI.com
<?php

$api = new LaravelFortnite;
$api->setKey("YOUR KEY");
?>
  1. Get datas from the API
<?php
$api = new LaravelFortnite;
$api->setKey("YOUR KEY");

// get and user id
$data = $api->user->id('username');
?>

Examples

You can build website like mine : tracker.fortnitefrance.eu

  1. Get an user id
<?php
$api = new LaravelFortnite;
$api->setKey("YOUR KEY");

$data = $api->user->id('username');

echo $data->uid;
echo $data->username;
?>
  1. Get user stats V2
<?php
$api = new LaravelFortnite;
$api->setKey("YOUR KEY");

$api->user->uid = 'user_id';

$data = $api->user->stats('console', 'window');

dump($data);
?>
  1. Get the daily store
<?php
$api = new LaravelFortnite;
$api->setKey("YOUR KEY");

$api = new FortniteClient;

$data = $api->items->store();

dump($data);
?>

  1. Fortnite server status
<?php
$api = new LaravelFortnite;
$api->setKey("YOUR KEY");

$data = $api->status->fetch();

echo $data->status;
echo $data->message;
echo $data->version;
?>

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

license. Please see the license file for more information.