https://github.com/saadj55/laravel-pubg
A Laravel Package for PUBG Official API
https://github.com/saadj55/laravel-pubg
api laravel playerunknow-s pubg pubgapi
Last synced: 8 months ago
JSON representation
A Laravel Package for PUBG Official API
- Host: GitHub
- URL: https://github.com/saadj55/laravel-pubg
- Owner: saadj55
- License: mit
- Created: 2018-04-04T20:32:37.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-02T11:23:18.000Z (over 6 years ago)
- Last Synced: 2025-07-02T11:52:06.795Z (11 months ago)
- Topics: api, laravel, playerunknow-s, pubg, pubgapi
- Language: PHP
- Size: 18.6 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Package for PUBG API
A Laravel Package for PUBG Official API
[](https://packagist.org/packages/saadj55/laravel-pubg)
[](https://packagist.org/packages/saadj55/laravel-pubg)
## Installation
Require this package with composer.
```shell
composer require saadj55/laravel-pubg
```
## Setup
### Laravel 5.5+ Integration
Package discovery is enabled so need for additional configuration.
### Laravel 5.* Integration
After installation, open ```config/app.php``` and add the following line to ```providers``` key
```Saadj55\LaravelPubg\Providers\LaravelPubgServiceProvider::class,```
After that, run the following command to publish configuration file.
```shell
php artisan vendor:publish
```
Set your access token in the ```.env``` file as ```PUBG_ACCESS_TOKEN=```
Set the region you want to query as ```PUBG_REGION=``` in the ```.env``` file.
Set the platform you want to query as ```PUBG_PLATFORM=``` in the ```.env``` file
## Usage
You can simply use the API by adding ```use Saadj55\LaravelPubg\Pubg;``` wherever you want to call the API
and making a new instance of the ```Pubg``` class as ```$pubg = new Pubg;```
## API
### getPlayerById
```shell
$pubg = new Pubg;
$player = $pubg->getPlayerById($player_id);
```
### getPlayersByIds
```shell
$pubg = new Pubg;
$player_ids = [1,2,3,4,5];
$player = $pubg->getPlayersByIds($player_ids);
```
### getPlayersByNames
```shell
$pubg = new Pubg;
$player_names = ['foo','bar'];
$player = $pubg->getPlayersByName($player_names);
```
### getMatchById
```shell
$pubg = new Pubg;
$match = $pubg->getMatchById($match_id);
```
By default, region name is set from the ```app/config/pubg.php```.
If you need to set the region on the fly, You can call ```$pubg->setRegion($region_name)``` before calling any
of the above methods.
You can also call ```$pubg->setPlatform($platform)```