10
10
[ ![ License] ( https://poser.pugx.org/syntax/steam-api/license.svg )] ( https://packagist.org/packages/syntax/steam-api )
11
11
12
12
** Version Support**
13
- ` Laravel >= 6 .0 `
14
- ` PHP >= 7.3.0 `
13
+ ` Laravel >= 10 .0 `
14
+ ` PHP >= 8.1 `
15
15
16
16
- [ Installation] ( #installation )
17
17
- [ Usage] ( #usage )
@@ -30,7 +30,7 @@ This package provides an easy way to get details from the Steam API service. Th
30
30
Begin by installing this package with composer.
31
31
32
32
"require": {
33
- "syntax/steam-api": "2. 3.*"
33
+ "syntax/steam-api": "3.*"
34
34
}
35
35
36
36
Next, update composer from the terminal.
@@ -41,10 +41,19 @@ Next, update composer from the terminal.
41
41
42
42
Lastly, publish the config file. You can get your API key from [ Steam] ( http://steamcommunity.com/dev/apikey ) .
43
43
44
- php artisan vendor:publish
44
+ php artisan vendor:publish --provider="Syntax\SteamApi\SteamApiServiceProvider"
45
45
46
46
## Usage
47
47
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
+
48
57
Each service from the Steam API has its own methods you can use.
49
58
50
59
- [ Global] ( #global )
@@ -75,7 +84,7 @@ format | string | The format you want back. | No | null
75
84
##### Example usage
76
85
77
86
``` php
78
- Steam ::convertId($id, $format);
87
+ SteamApi ::convertId($id, $format);
79
88
```
80
89
81
90
> Example Output: [ convertId] ( ./examples/global/convertId.txt )
@@ -84,7 +93,7 @@ Steam::convertId($id, $format);
84
93
The [ Steam News] ( https://developer.valvesoftware.com/wiki/Steam_Web_API#GetNewsForApp_.28v0002.29 ) web api is used to get articles for games.
85
94
86
95
``` php
87
- Steam ::news()
96
+ SteamApi ::news()
88
97
```
89
98
90
99
#### GetNewsForApp
@@ -102,7 +111,7 @@ maxlength | int | The maximum number of characters to return | No | null
102
111
103
112
``` php
104
113
<?php
105
- $news = Steam ::news()->GetNewsForApp($appId, 5, 500)->newsitems;
114
+ $news = SteamApi ::news()->GetNewsForApp($appId, 5, 500)->newsitems;
106
115
?>
107
116
```
108
117
@@ -114,7 +123,7 @@ The [Player Service](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetO
114
123
When instantiating the player class, you are required to pass a steamId or Steam community ID.
115
124
116
125
``` php
117
- Steam ::player($steamId)
126
+ SteamApi ::player($steamId)
118
127
```
119
128
120
129
#### GetSteamLevel
@@ -178,7 +187,7 @@ The [User](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_
178
187
When instantiating the user class, you are required to pass at least one steamId or steam community ID.
179
188
180
189
``` php
181
- Steam ::user($steamId)
190
+ SteamApi ::user($steamId)
182
191
```
183
192
184
193
#### ResolveVanityURL
@@ -191,7 +200,7 @@ Name | Type | Description | Required | Default
191
200
displayName| string | The display name to get the steam ID for. In ` http://steamcommunity.com/id/gabelogannewell ` it would be ` gabelogannewell ` . | Yes | NULL
192
201
193
202
``` php
194
- $player = Steam ::user($steamId)->ResolveVanityURL('gabelogannewell');
203
+ $player = SteamApi ::user($steamId)->ResolveVanityURL('gabelogannewell');
195
204
```
196
205
197
206
> 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
208
217
``` php
209
218
// One user
210
219
$steamId = 76561197960287930;
211
- $player = Steam ::user($steamId)->GetPlayerSummaries()[0];
220
+ $player = SteamApi ::user($steamId)->GetPlayerSummaries()[0];
212
221
213
222
// Several users
214
223
$steamIds = [76561197960287930, 76561197968575517]
215
- $players = Steam ::user($steamIds)->GetPlayerSummaries();
224
+ $players = SteamApi ::user($steamIds)->GetPlayerSummaries();
216
225
```
217
226
218
227
> Example Output: [ GetPlayerSummaries] ( ./examples/user/GetPlayerSummaries.txt )
@@ -250,7 +259,7 @@ The [User Stats](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlaye
250
259
When instantiating the user stats class, you are required to pass a steamID or Steam community ID.
251
260
252
261
``` php
253
- Steam ::userStats($steamId)
262
+ SteamApi ::userStats($steamId)
254
263
```
255
264
256
265
#### GetPlayerAchievements
@@ -306,7 +315,7 @@ appId| int | The ID of the game you want the details for. | Yes |
306
315
This area will get details for games.
307
316
308
317
``` php
309
- Steam ::app()
318
+ SteamApi ::app()
310
319
```
311
320
312
321
#### appDetails
@@ -332,7 +341,7 @@ This method will return an array of app objects directly from Steam. It include
332
341
This method will get details for packages.
333
342
334
343
``` php
335
- Steam ::package()
344
+ SteamApi ::package()
336
345
```
337
346
338
347
#### packageDetails
@@ -353,7 +362,7 @@ l | string | The l is the language parameter, you can get the appropriate langua
353
362
This method will get user inventory for item.
354
363
355
364
``` php
356
- Steam ::item()
365
+ SteamApi ::item()
357
366
```
358
367
359
368
#### GetPlayerItems
@@ -374,7 +383,7 @@ steamid | int | The steamid of the Steam user you want for | Yes |
374
383
This service is used to get details on a Steam group.
375
384
376
385
``` php
377
- Steam ::group()
386
+ SteamApi ::group()
378
387
```
379
388
380
389
#### GetGroupSummary
@@ -390,7 +399,7 @@ group| string or int | The ID or the name of the group. | Yes
390
399
391
400
``` php
392
401
<?php
393
- $news = Steam ::group()->GetGroupSummary('Valve');
402
+ $news = SteamApi ::group()->GetGroupSummary('Valve');
394
403
?>
395
404
```
396
405
@@ -402,20 +411,23 @@ A Steam API key must be provided or most tests will fail.
402
411
403
412
** Run Tests**
404
413
```
414
+ # Build container
415
+ docker-compose build
416
+
405
417
# Install dependancies
406
- docker-compose run php composer install
418
+ docker-compose run --rm php composer install
407
419
408
420
# Run tests (assumes apiKey is set in .env file)
409
- docker-compose run php composer test
421
+ docker-compose run --rm php composer test
410
422
411
423
# 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
413
425
414
426
# With coverage
415
- docker-compose run php composer coverage
427
+ docker-compose run --rm php composer coverage
416
428
417
429
# Play around
418
- docker-compose run php bash
430
+ docker-compose run --rm php bash
419
431
```
420
432
421
433
## Contributors
0 commit comments