Installation
composer require jummpgategaming/wargaming
, (*1)
Set up
API details
Update your config/services.php
to include wargaming
., (*2)
'wargaming' => [
'client_id' => null,
'client_secret' => env('WARGAMING_API_KEY'),
'redirect' => env('WARGAMING_REDIRECT_URI'),
],
Service provider
You should add the provider to your providers[]
array in config/app.php
., (*3)
'providers' => [
...
JumpGateGaming\Wargaming\Providers\WargamingServiceProvider::class,
...
],
Obviously you will need to add these keys to your .env
file. You can register an application at
their api dashboard., (*4)
Authentication
This package comes with support for authorization built in using Laravel Socialite Providers. You will need to do some
extra set up if you want to use it., (*5)
- Remove
Laravel\Socialite\SocialiteServiceProvider
from your providers[]
array in config\app.php
if you have
added it already.
- Add
\SocialiteProviders\Manager\ServiceProvider::class
to your providers[]
array in config\app.php
.
- Add
SocialiteProviders\Manager\SocialiteWasCalled
event to your listen[]
array in
app/Providers/EventServiceProvider
.
- Add your listeners (i.e. the ones from the providers) to the
SocialiteProviders\Manager\SocialiteWasCalled[]
that
you just created.
- The listener that you add for this provider is
'JumpGateGaming\\Wargaming\\Providers\\Socialite\\WargamingExtendSocialite@handle',
.
Example:, (*6)
/**
* The event handler mappings for the application.
*
* @var array
*/
protected $listen = [
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
// add your listeners (aka providers) here
'JumpGateGaming\\Wargaming\\Providers\\Socialite\\WargamingExtendSocialite@handle',
],
];
Now to use it you would just call return Socialite::with('wargaming')->redirect();
., (*7)
Available methods
To call anything at all you will need to begin with calling app('wargaming')
. This is the entry point for everything
else. From there you call to the API you want to interact with. That would be one of tanks()
, warships()
or
warplanes()
. Next you call the overall section you want then the method., (*8)
Here's an example call:, (*9)
$wargaming = app('wargaming');
$tanks = $wargaming->tanks()->encyclopedia()->vehicles();
The below lists represent all working methods. Anything not listed here has not been added yet., (*10)
World of Tanks
World of Warships
World of Warplanes