Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darkintaqt/malphphite
A rock solid PHP library for the League Of Legends API.
https://github.com/darkintaqt/malphphite
leagueoflegends leagueoflegendsapi php
Last synced: 2 months ago
JSON representation
A rock solid PHP library for the League Of Legends API.
- Host: GitHub
- URL: https://github.com/darkintaqt/malphphite
- Owner: DarkIntaqt
- Created: 2022-06-05T17:25:55.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T12:43:30.000Z (9 months ago)
- Last Synced: 2024-10-10T20:10:24.964Z (3 months ago)
- Topics: leagueoflegends, leagueoflegendsapi, php
- Language: PHP
- Homepage: https://darkintaqt.com/blog/malphphite
- Size: 45.9 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# malPHPhite
[![CodeFactor](https://www.codefactor.io/repository/github/darkintaqt/malphphite/badge)](https://www.codefactor.io/repository/github/darkintaqt/malphphite)
A rock-solid php library for the league of legends API.
## Quick start
### Usage example
To get quickly started with this library, include the library first. Then, generate a new LeagueOfLegendsAPI object.After that we fetch "Hide on bush"'s profile in KR and print the result.
```php
getAccountByRiotId("Hide on bush","KR1")["puuid"]; # $api->getAccountByRiotId("Hide on bush#KR1")["puuid"] would also work
$summoner =$api->getSummonerByPUUID($puuid);
print_r($summoner);
# {
# "id": ...,
# "accountId": ...,
# "puuid": ...,
# "name": "Hide on bush",
# ...
#}
?>
```### Generating a new object
To use this library you need to generate a new object from the LeagueOfLegendsAPI class.The constructor takes several parameters
| Parameter | Type | Example | Required |
| -------------- | ------------- | -------------------- | :--------------------: |
| Api Key | String | "RGAPI-..." | **YES** |
| Region | String | "euw1", "euw" | **YES** |
| Cache | Boolean | true | **NO** (default: true) |
| CacheDirectory | String (Path) | "/var/tmp/api-cache" | **NO** (default: /tmp) |### Error Handling
The library throws error if the usage is wrong.
If the Riot Games API throws errors to the library the library returns the **Integer** as a return value.For example:
```php
$summoner = $api->getSummonerByName("THIS SUMMONER DOES NOT EXIST");
# returns 404# possible catches are
if(gettype($summoner) === "integer") {
echo "the requested summoner does not exist";
}
```### Documentation
Please read the [docs](https://github.com/DarkIntaqt/malPHPhite/tree/main/docs) for a detailed description.## Disclaimer
This library should work, but of course there is no warranty for using it.*The 'MalPHPhite' isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc.*