Download the PHP package chypriote/pandascore-php without Composer
On this page you can find all versions of the php package chypriote/pandascore-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download chypriote/pandascore-php
More information about chypriote/pandascore-php
Files in chypriote/pandascore-php
Package pandascore-php
Short Description PandaScore API wrapper for PHP7
License GPL-3.0-or-later
Homepage https://github.com/chypriote/pandascore-php
Informations about the package pandascore-php
PandaScore PHP7 wrapper
Version v1.0.0-rc.1
Table of Contents
- Introduction
- Downloading
- League of Legends API
- Resource versions
- Initializing the library
- Usage example
- Cache providers
- Rate limiting
- Call caching
- Asynchronous requests
- Extensions
- Callback functions
- CLI support
Introduction
Welcome to the PandaScore PHP7 library repo! The goal of this library is to create easy-to-use library for anyone who might need one. This is fully object oriented API wrapper for PandaScore' API.
Here are some handy features:
- Rate limit caching and limit exceeding prevention - fully automatic.
- Call caching - this enables the library to re-use already fetched data within short timespan - saving time and API rate limit.
- Custom callbacks - you can set custom function which will be called before or after the request is processed.
- Object extensions - you can implement own methods to the fetched API objects itself and enable yourself to use them later to ease of your work.
- CLI supported! You can use the library easily even in PHP CLI mode.
- Objects everywhere! API calls return data in special objects.
Downloading
The easiest way to get this library is to use Composer.
While having Composer installed it takes only composer require chypriote/pandascore-php
and composer install
to get the library ready to roll!
PandaScore API
Resources
Below you can find table of implemented API resources. Endpoints without status are not planned to be implemented yet.
Resource | Status |
---|---|
All Videogames - Leagues | |
All Videogames - Series | |
All Videogames - Tournaments | |
All Videogames - Matches | |
All Videogames - Teams | |
All Videogames - Players | |
LOL - Champions | |
LOL - Games | |
LOL - Items | |
LOL - Leagues | |
LOL - Masteries | |
LOL - Matches | |
LOL - Players | |
LOL - Runes | |
LOL - Series | |
LOL - Spells | |
LOL - Stats | |
LOL - Teams | |
LOL - Tournaments | |
CSGO | |
DOTA 2 | |
Overwatch |
Initializing the library
How to begin?
And there is a lot more what you can set when initializing the library - mainly to enable special features or to amend behaviour of the library.
Usage example
Working with PandaScoreAPI can not be easier, just watch how to fetch a league information based on its id:
Cache providers
Cache providers are responsible for keeping data of call caching within instances of the library. This feature is automatically enabled, when any of previously mentioned features is used.
When using this feature, you can set PandaScoreAPI::SET_CACHE_PROVIDER
to any class, thought it has to implement Objects\ICacheProvider
interface.
By using PandaScoreAPI::SET_CACHE_PROVIDER_PARAMS
option, you can pass any variables to the cache provider.
Rate limiting
This clever feature will easily prevent exceeding your per key call limits & method limits.
In order to enable this feature, you have to set PandaScoreAPI::SET_CACHE_RATELIMIT
to true
.
Everything is completly automatic, so all you need to do is to enable this feature.
Call caching
This feature can prevent unnecessary calls to API within short timespan by temporarily saving fetched data from API and using them as the result data.
In order to enable this feature, you have to set PandaScoreAPI::SET_CACHE_CALLS
to true
.
You should also provide PandaScoreAPI::SET_CACHE_CALLS_LENGTH
option or else default time interval of 60 seconds
will be used.
Asynchronous requests
This feature allows request grouping and their asynchronous sending using Guzzle. After request is sent and its response received, user provided callbacks are invoked with received data.
Extensions
Using extensions for ApiObjects is useful tool, allowing implementation of your own methods into the ApiObjects itself.
Extensions are enabled by using settings option PandaScoreAPI::SET_EXTENSIONS
when initializing the library.
Callback functions
Allows you to provide custom functions to be called before and after the actual API request is sent.
Before callbacks have ability to cancel upcomming request - when false
is returned by any callback function, exception Exceptions\RequestException
is raised and request is cancelled.
CLI support
You can easily get API results even in CLI: