jumpgategaming / wargaming
Requires
- guzzlehttp/guzzle: ~6.0
- jenssegers/model: ~1.1
- jumpgate/database: ~1.0
- socialiteproviders/manager: ~2.0 || ~3.0
This package is auto-updated.
Last update: 2024-10-27 22:25:29 UTC
README
Installation
composer require jummpgategaming/wargaming
Set up
API details
Update your config/services.php
to include wargaming
.
'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
.
'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.
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.
- Remove
Laravel\Socialite\SocialiteServiceProvider
from yourproviders[]
array inconfig\app.php
if you have added it already. - Add
\SocialiteProviders\Manager\ServiceProvider::class
to yourproviders[]
array inconfig\app.php
. - Add
SocialiteProviders\Manager\SocialiteWasCalled
event to yourlisten[]
array inapp/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:
/** * 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();
.
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.
Here's an example call:
$wargaming = app('wargaming'); $tanks = $wargaming->tanks()->encyclopedia()->vehicles();
The below lists represent all working methods. Anything not listed here has not been added yet.