Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
dimuska139 committed Sep 4, 2020
0 parents commit 13be361
Show file tree
Hide file tree
Showing 83 changed files with 14,814 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vendor
.idea
tmp
tests/_output/*
index.php
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# RAWG Video Games Database PHP client

This is RAWG PHP SDK. This library contains methods for interacting with RAWG API.

## Installation

`composer require dimuska139/rawg-sdk-php`

## Usage

```php
require 'vendor/autoload.php';
use Rawg\ApiClient;
use Rawg\Config;
use Rawg\DateRange;
use Rawg\Filters\GamesFilter;
use Rawg\Filters\PaginationFilter;

$cfg = new Config('YourAppName', 'en'); // 'YourAppName' will be set as User-Agent header
$client = new ApiClient($cfg);

$additionsFilter = (new PaginationFilter())->setPage(1)->setPageSize(5);
print_r($client->games()->getAdditions(47, $additionsFilter)->getData());

$gamesFilter = (new GamesFilter())
->setPage(1)
->setPageSize(20)
->setDates([
DateRange::create(new DateTime( '2012-02-01' ), new DateTime( '2015-06-25' ))
])
->setOrdering('-name')
->setTags([1,2,3]);

print_r($client->games()->getGames($gamesFilter)->getData());
```

The tests should be considered a part of the documentation.

## License

RAWG PHP SDK is released under the
[MIT License](http://www.opensource.org/licenses/MIT).
15 changes: 15 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed
coverage:
enabled: true
show_only_summary: true
include:
- src/*
38 changes: 38 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "dimuska139/rawg-sdk-php",
"description": "",
"keywords": [ "php", "rawg", "sdk"],
"homepage": "https://github.com/dimuska139/rawg-sdk-php",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Dmitriy Sviridov",
"email": "dimuska139@gmail.com"
}
],
"require": {
"php": ">=7.0",
"guzzlehttp/guzzle": "^7.0",
"ext-json": "*",
"lukasoppermann/http-status": "^2.0"
},
"autoload": {
"psr-4": {
"Rawg\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Rawg\\Tests\\": "tests/unit/"
}
},
"require-dev": {
"codeception/codeception": "^4.1",
"codeception/module-phpbrowser": "^1.0.0",
"codeception/module-asserts": "^1.0.0"
},
"scripts": {
"test": "vendor/bin/codecept run unit --coverage-text --no-colors"
}
}
Loading

0 comments on commit 13be361

Please sign in to comment.