Download the PHP package dherran/laravel-rawg without Composer
On this page you can find all versions of the php package dherran/laravel-rawg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dherran/laravel-rawg
More information about dherran/laravel-rawg
Files in dherran/laravel-rawg
Package laravel-rawg
Short Description Collection of RAWG API methods for Laravel
License MIT
Homepage https://dherran.github.io/laravel-rawg/
Informations about the package laravel-rawg
Collection of RAWG API Web Services for Laravel 6-8
Provides a convenient way of setting up and making requests to the RAWG API from a Laravel application. For RAWG endpoint documentation, rate limits and licencing please visit the RAWG API Docs.
Dependency
Installation
Install the package via Composer:
Configuration
Publish the configuration file using php artisan vendor:publish --provider="Rawg\RawgServiceProvider"
or simply copy the package configuration file and paste it into config/rawg.php
Open the config file config/rawg.php
and add your app API Key obtainable at https://rawg.io/apidocs.
As per the RAWG API Docs: Every API request should have an API Key. If you don’t provide it, we may ban your requests.
Usage
Here is an example of making request to Games endpoint:
Or finding details for a specific game:
The principle is that the load method takes the endpoint as provided by RAWG.
Available methods
load( $endpoint )
setParamByKey($key, $value)
setParams($parameters)
get()
get($key)
load( $serviceName )
- prepare the endpoint name
Accepts string as parameter. You can find all endpoints in the RAWG API Docs. Returns a reference to itself.
setParamByKey( $key, $value )
- set the request parameter using key:value pair
Accepts two parameters:
key
- body parameter namevalue
- body parameter value
Deeply nested arrays can use 'dot' notation to assign values.
Returns a reference to itself.
setParams( $parameters)
- set all request parameters at once
Accepts and array of parameters
Returns a reference to itself.
get()
- performs a RESTful request via GETget($key)
- filter downs the request result. Dot notation is supported here
Example with $key
parameter