PHP code example of dherran / laravel-rawg

1. Go to this page and download the library: Download dherran/laravel-rawg 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/ */

    

dherran / laravel-rawg example snippets


composer 

    /*
    |----------------------------------
    | API Key
    |------------------------------------
    */
    
    'api_key' => 'XYZ',

$response = \Rawg::load('games')->setParams([
                'page' => 1,
                'page_size' => 40,
                'ordering' => '-rating',
            ])->get();

$response = \Rawg::load('games/{id}')->setParams([
                'id' => 86,
            ])->get();


\Rawg::load('publishers') 
... 


$endpoint = \Rawg::load('publishers')
   ->setParamByKey('page', 3)
   ->setParamByKey('page_size', 10)
    ...

$response = \Rawg::load('games')
                ->setParam([
                   'search' => 'monster',
                   'tags' => 'multiplayer',
                ])
...

$response = \Rawg::load('games')
                ->setParamByKey('search', 'monster')
                 ->get();

$response = \Rawg::load('games')
                ->setParamByKey('search', 'monster')
                 ->get('results');