Download the PHP package dant89/smite-api-php-client without Composer
On this page you can find all versions of the php package dant89/smite-api-php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dant89/smite-api-php-client
More information about dant89/smite-api-php-client
Files in dant89/smite-api-php-client
Package smite-api-php-client
Short Description A lightweight PHP client for Smite API
License MIT
Informations about the package smite-api-php-client
Smite API PHP Client
A lightweight PHP client for the Smite developer API.
Installation
To install, run composer require dant89/smite-api-php-client
in the root of your project or add dant89/smite-api-php-client
to your composer.json.
Smite developer API Documentation
To read more about how the Smite developer API functions, please read the official documentation.
Smite developer API Access
The Smite developer API requires that you first complete this form to apply for credentials.
If your application is accepted you will receive custom credentials to access the API.
- Smite
Usage
Use your provided DevId
and AuthKey
upon instantiation of this client.
To begin using the API, you will first need to establish a valid Session. To do so you will start a session (via the createsession method) and receive a SessionId. Sessions are used for authentication, security, monitoring, and throttling. Once you obtain a SessionId, you will pass it to other methods for authentication. Each session only lasts for 15 minutes and must be recreated afterward.
- Smite
Now that you have a $sessionId
you are free to make calls to the other client methods. This client takes care of signing the requests so you don't need to worry about that and can now make calls to other methods, for example to get a teams (clans) players, you would use:
Rate Limiting / Caching Suggestion
I recommend that you implement some sort of caching of your $sessionId
and / or returned data, the Smite developer API has rate limits so caching will help you avoid going over those limits:
Default limits:
concurrent_sessions: 50
sessions_per_day: 500
session_time_limit: 15 minutes
request_day_limit: 7500
Helpers
languageCode
values:
1
English2
German3
French5
Chinese7
Spanish9
Spanish (Latin America)10
Portuguese11
Russian12
Polish13
Turkish
Tests
You can test your API key by running the PHPUnit tests included in this client.
At present there is no rate limiting or caching so a run through will use 7 of your daily sessions (this is not ideal).
PHPUnit tests:
- Add your
devId
andauthKey
totests/Helper/ClientTestCase.php
php vendor/phpunit/phpunit/phpunit tests
PHP CodeSniffer:
php vendor/squizlabs/php_codesniffer/bin/phpcs src --standard=PSR2 --severity=5 --extensions=php
PHP MessDetector
php vendor/phpmd/phpmd/src/bin/phpmd src text controversial,unusedcode,design
Contributions
Contributions to the client are welcome, to contribute please:
- Fork this repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new pull request