getting player stats for Playstation trophies is easy task but required paid services around 20$ per month, so since I love gaming and coding I decided to make my own simple API to bring basic information for players such as number of trophies or their avatar and last game played etc..
if you looking for php class without using Laravel you can use this PSNApi
import package into your project using composer
composer require hawkiq/larapsn
initial using PSN id
use Hawkiq\Larapsn\HawkiqPSN;
// rest of used classes
$psnID = "hawkiq";
$psnapi = new HawkiqPSN($psnID);
Now you can get All player info using one method
$playerInfo = $psnapi->getInfos();
Here is the final output from getInfos method
{
"username": "hawkiq ",
"about": "* Founder of Iraqi PlayStation Players Leaderboard • * instagram:hawkiq • oJJI IJI oJI IJ",
"avatar": "https://i.psnprofiles.com/avatars/l/G4613a5e4c.png",
"trophies": {
"total": 5595,
"platinum": 112,
"gold": 404,
"silver": 1090,
"bronze": 3989
},
"level": "409",
"lastgame": "A Plague Tale: Innocence",
"played": "158",
"completion": "73.62",
"complgames": "78",
"hiddentrophies": 0
}
If you discover a security vulnerability within Larapsn, please send an e-mail to OsaMa via [email protected]. All security vulnerabilities will be promptly addressed.
this class used in following sites
feel free to contact me if you want to add your site.
Larapsn is open-sourced software licensed under the MIT license.