PHP code example of strebl / laravel-league-api

1. Go to this page and download the library: Download strebl/laravel-league-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

strebl / laravel-league-api example snippets


// Set the region (default: na).
LeagueApi::setRegion('euw');

// Get info about a summoner.
LeagueApi::summoner()->info('liqy');

// Get the recent games for liqy.
LeagueApi::game()->recent(LeagueApi::summoner()->get('liqy'));

Strebl\LeagueApi\LeagueApiServiceProvider::class

'LeagueApi' => Strebl\LeagueApi\Facades\LeagueApi::class

// You can alias this in config/app.php.
use Strebl\LeagueApi\Facades\LeagueApi;

LeagueApi::summoner()->info('liqy');
// That's everything. It works!

use Strebl\LeagueApi\Facades\LeagueApi;

// Writing this…
LeagueApi::connection('main')->summoner()->info('liqy');

// …is identical to writing this
LeagueApi::summoner()->info('liqy');

// and is also identical to writing this.
LeagueApi::connection()->summoner()->info('liqy');

// This is because the main connection is configured to be the default.
LeagueApi::getDefaultConnection(); // This will return main.

// We can change the default connection.
LeagueApi::setDefaultConnection('alternative'); // The default is now alternative.

use Strebl\LeagueApi\LeagueApiManager;

class Foo
{
	protected $leagueApi;

	public function __construct(LeagueApiManager $leagueApi)
	{
		$this->leagueApi = $leagueApi;
	}

	public function bar($name)
	{
		$this->leagueApi->summoner()->info($name);
	}
}

App::make('Foo')->bar();
bash
$ php artisan vendor:publish