Skip to content

Commit 425099e

Browse files
authored
Support Laravel 10+ (#139)
* Support PHP 8.1 and Laravel 9 * Fix typo in Github actions * Prepare for v3 * [Laravel 10] Support PHP 8.1 - 8.3, Bump minimum Laravel to 10. * [Laravel 10] Bump composer deps for min Laravel version 10 * [Laravel 10] Migrate PHPUnit schema. * [Laravel 10] Resolve current test failures * [Laravel 10] Bump actions versions Update minimum Laravel version in README * [Laravel 10] Revert steamID change in tests. * [Laravel 10] Support Laravel 11 * [Laravel 10] Cleanup * [Laravel 10] Update README
1 parent 48e9354 commit 425099e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4350
-2316
lines changed

.env.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Steam API key for testing
22
apiKey=
3-
XDEBUG_MODE=coverage
3+
XDEBUG_MODE=coverage
4+
PHP_VERSION=8.1

.github/workflows/php.yml

+11-8
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,30 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
php: [ '8.0', '7.4', '7.3' ]
14+
php: [ '8.1', '8.2', '8.3' ]
1515
continue-on-error: true
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818

1919
- name: Setup PHP
2020
uses: shivammathur/setup-php@v2
2121
with:
2222
php-version: ${{ matrix.php }}
23-
extensions: bcmath, simplexml, libxml, curl, json
23+
extensions: bcmath, simplexml, libxml, curl, json, sodium
2424
coverage: pcov
2525

26+
- name: Mitigate Composer lock issues
27+
run: composer update
28+
2629
- name: PHP ${{ matrix.php }} - Validate composer.json and composer.lock
2730
run: composer validate
2831

2932
- name: PHP ${{ matrix.php }} - Cache Composer packages
3033
id: composer-cache
31-
uses: actions/cache@v2
34+
uses: actions/cache@v4
3235
with:
3336
path: vendor
3437
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
@@ -45,8 +48,8 @@ jobs:
4548
run: composer run-script test
4649

4750
- name: Publish Test Coverage
48-
uses: paambaati/codeclimate-action@v2.7.5
49-
if: ${{ matrix.php }} == '8.0' && ${{ github.ref }} == 'master'
51+
uses: paambaati/codeclimate-action@v6
52+
if: ${{ matrix.php }} == '8.1' && ${{ github.ref }} == 'master'
5053
env:
5154
apiKey: ${{ secrets.STEAM_API_KEY }}
5255
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
@@ -62,4 +65,4 @@ jobs:
6265
status: ${{ job.status }}
6366
webhook: ${{ secrets.DISCORD_WEBHOOK }}
6467
title: "${{ matrix.php }}: Tests failed."
65-
color: 'red'
68+
color: 'red'

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/.idea
22
/vendor
3+
/coverage
34
composer.phar
45
.DS_Store
56
ocular.phar
67
uploadTests.sh
78
.env
89
.phpunit.*
9-
*.clover
10+
*.clover

README.md

+35-23
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
[![License](https://poser.pugx.org/syntax/steam-api/license.svg)](https://packagist.org/packages/syntax/steam-api)
1111

1212
**Version Support**
13-
`Laravel >= 6.0`
14-
`PHP >= 7.3.0`
13+
`Laravel >= 10.0`
14+
`PHP >= 8.1`
1515

1616
- [Installation](#installation)
1717
- [Usage](#usage)
@@ -30,7 +30,7 @@ This package provides an easy way to get details from the Steam API service. Th
3030
Begin by installing this package with composer.
3131

3232
"require": {
33-
"syntax/steam-api": "2.3.*"
33+
"syntax/steam-api": "3.*"
3434
}
3535

3636
Next, update composer from the terminal.
@@ -41,10 +41,19 @@ Next, update composer from the terminal.
4141
4242
Lastly, publish the config file. You can get your API key from [Steam](http://steamcommunity.com/dev/apikey).
4343

44-
php artisan vendor:publish
44+
php artisan vendor:publish --provider="Syntax\SteamApi\SteamApiServiceProvider"
4545

4646
## Usage
4747

48+
```php
49+
use Syntax\SteamApi\Facades\SteamApi;
50+
51+
/** Get Portal 2 */
52+
$apps = SteamApi::app()->appDetails([620]);
53+
54+
echo $app->first()->name;
55+
```
56+
4857
Each service from the Steam API has its own methods you can use.
4958

5059
- [Global](#global)
@@ -75,7 +84,7 @@ format | string | The format you want back. | No | null
7584
##### Example usage
7685

7786
```php
78-
Steam::convertId($id, $format);
87+
SteamApi::convertId($id, $format);
7988
```
8089

8190
> Example Output: [convertId](./examples/global/convertId.txt)
@@ -84,7 +93,7 @@ Steam::convertId($id, $format);
8493
The [Steam News](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetNewsForApp_.28v0002.29) web api is used to get articles for games.
8594

8695
```php
87-
Steam::news()
96+
SteamApi::news()
8897
```
8998

9099
#### GetNewsForApp
@@ -102,7 +111,7 @@ maxlength | int | The maximum number of characters to return | No | null
102111

103112
```php
104113
<?php
105-
$news = Steam::news()->GetNewsForApp($appId, 5, 500)->newsitems;
114+
$news = SteamApi::news()->GetNewsForApp($appId, 5, 500)->newsitems;
106115
?>
107116
```
108117

@@ -114,7 +123,7 @@ The [Player Service](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetO
114123
When instantiating the player class, you are required to pass a steamId or Steam community ID.
115124

116125
```php
117-
Steam::player($steamId)
126+
SteamApi::player($steamId)
118127
```
119128

120129
#### GetSteamLevel
@@ -178,7 +187,7 @@ The [User](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_
178187
When instantiating the user class, you are required to pass at least one steamId or steam community ID.
179188

180189
```php
181-
Steam::user($steamId)
190+
SteamApi::user($steamId)
182191
```
183192

184193
#### ResolveVanityURL
@@ -191,7 +200,7 @@ Name | Type | Description | Required | Default
191200
displayName| string | The display name to get the steam ID for. In `http://steamcommunity.com/id/gabelogannewell` it would be `gabelogannewell`. | Yes | NULL
192201

193202
```php
194-
$player = Steam::user($steamId)->ResolveVanityURL('gabelogannewell');
203+
$player = SteamApi::user($steamId)->ResolveVanityURL('gabelogannewell');
195204
```
196205

197206
> Example Output: [ResolveVanityURL](./examples/user/ResolveVanityURL.txt)
@@ -208,11 +217,11 @@ steamId| int[] | An array of (or singular) steam ID(s) to get details for | No
208217
```php
209218
// One user
210219
$steamId = 76561197960287930;
211-
$player = Steam::user($steamId)->GetPlayerSummaries()[0];
220+
$player = SteamApi::user($steamId)->GetPlayerSummaries()[0];
212221

213222
// Several users
214223
$steamIds = [76561197960287930, 76561197968575517]
215-
$players = Steam::user($steamIds)->GetPlayerSummaries();
224+
$players = SteamApi::user($steamIds)->GetPlayerSummaries();
216225
```
217226

218227
> Example Output: [GetPlayerSummaries](./examples/user/GetPlayerSummaries.txt)
@@ -250,7 +259,7 @@ The [User Stats](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlaye
250259
When instantiating the user stats class, you are required to pass a steamID or Steam community ID.
251260

252261
```php
253-
Steam::userStats($steamId)
262+
SteamApi::userStats($steamId)
254263
```
255264

256265
#### GetPlayerAchievements
@@ -306,7 +315,7 @@ appId| int | The ID of the game you want the details for. | Yes |
306315
This area will get details for games.
307316

308317
```php
309-
Steam::app()
318+
SteamApi::app()
310319
```
311320

312321
#### appDetails
@@ -332,7 +341,7 @@ This method will return an array of app objects directly from Steam. It include
332341
This method will get details for packages.
333342

334343
```php
335-
Steam::package()
344+
SteamApi::package()
336345
```
337346

338347
#### packageDetails
@@ -353,7 +362,7 @@ l | string | The l is the language parameter, you can get the appropriate langua
353362
This method will get user inventory for item.
354363

355364
```php
356-
Steam::item()
365+
SteamApi::item()
357366
```
358367

359368
#### GetPlayerItems
@@ -374,7 +383,7 @@ steamid | int | The steamid of the Steam user you want for | Yes |
374383
This service is used to get details on a Steam group.
375384

376385
```php
377-
Steam::group()
386+
SteamApi::group()
378387
```
379388

380389
#### GetGroupSummary
@@ -390,7 +399,7 @@ group| string or int | The ID or the name of the group. | Yes
390399

391400
```php
392401
<?php
393-
$news = Steam::group()->GetGroupSummary('Valve');
402+
$news = SteamApi::group()->GetGroupSummary('Valve');
394403
?>
395404
```
396405

@@ -402,20 +411,23 @@ A Steam API key must be provided or most tests will fail.
402411

403412
**Run Tests**
404413
```
414+
# Build container
415+
docker-compose build
416+
405417
# Install dependancies
406-
docker-compose run php composer install
418+
docker-compose run --rm php composer install
407419
408420
# Run tests (assumes apiKey is set in .env file)
409-
docker-compose run php composer test
421+
docker-compose run --rm php composer test
410422
411423
# Or with the apiKey inline
412-
docker-compose run -e api=YOUR_STEAM_API_KEY php composer test
424+
docker-compose run --rm -e api=YOUR_STEAM_API_KEY php composer test
413425
414426
# With coverage
415-
docker-compose run php composer coverage
427+
docker-compose run --rm php composer coverage
416428
417429
# Play around
418-
docker-compose run php bash
430+
docker-compose run --rm php bash
419431
```
420432

421433
## Contributors

composer.json

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "syntax/steam-api",
3-
"description": "A steam-api client for Laravel 6+",
4-
"version": "2.3.0",
3+
"description": "A steam-api client for Laravel 10+",
4+
"version": "3.0.0",
55
"license": "MIT",
66
"authors": [
77
{
@@ -10,19 +10,20 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.3|^8.0",
14-
"laravel/framework": "^6.20.12|^7.30.3|^8.22.1",
15-
"guzzlehttp/guzzle": "^7.0",
13+
"php": "^8.1",
14+
"laravel/framework": "^10.0|^11.0",
15+
"guzzlehttp/guzzle": "^7.8",
1616
"ext-bcmath": "*",
1717
"ext-simplexml": "*",
1818
"ext-libxml": "*",
1919
"ext-curl": "*",
2020
"ext-json": "*"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^9.5",
24-
"orchestra/testbench": "^6.0",
25-
"vlucas/phpdotenv": "^5.2"
23+
"phpunit/phpunit": "^10.5|^11.0",
24+
"orchestra/testbench": "^8.0",
25+
"vlucas/phpdotenv": "^5.6",
26+
"rector/rector": "^1.0"
2627
},
2728
"autoload": {
2829
"psr-4": {
@@ -38,7 +39,8 @@
3839
},
3940
"minimum-stability": "stable",
4041
"scripts": {
41-
"test": "vendor/bin/phpunit",
42-
"coverage": "vendor/bin/phpunit --coverage-clover=coverage.clover"
42+
"test": "XDEBUG_MODE=off vendor/bin/phpunit -d memory_limit=512M",
43+
"coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit -d memory_limit=512M --coverage-clover=coverage.clover",
44+
"coverage:html": "XDEBUG_MODE=coverage vendor/bin/phpunit -d memory_limit=512M --coverage-html ./coverage"
4345
}
4446
}

0 commit comments

Comments
 (0)