This library aims to provide the tools to communicate with the Pokemon Go API. It is still work in progress.
This package is compliant with PSR-1, PSR-2 and PSR-4. If you notice compliance oversights, please send a patch via pull request.
Via Composer
$ composer require drdelay/pokemon-go
$auth = (new \DrDelay\PokemonGo\Auth\PtcAuth())
->setCredentials('PTCUser', 'PTCPass');
// Check the folder ./src/Auth for more Auth implementations
$client = (new \DrDelay\PokemonGo\Client())
->setCache(...) // Any PSR-6 compliant cache (Optional for Ptc/GoogleAuth, **necessary** for GoogleOAuth, recommended always)
->setAuth($auth) // Anything implementing \DrDelay\PokemonGo\Auth\AuthInterface
->setLogger(...); // Optional, any PSR-3 compliant logger
$client->setLocation(...); // A \DrDelay\PokemonGo\Geography\Coordinate , optional
$playerData = $client->login(); // Returns an instance of \POGOProtos\Data\PlayerData
$response = $client->sendRequest(...); // Define own requests by implementing \DrDelay\PokemonGo\Request\ApiRequestInterface / extending \DrDelay\PokemonGo\Request\AbstractApiRequest
// See \DrDelay\PokemonGo\Request\ApiRequests\GetPlayerRequest/ExampleMultiRequest as examples
- Protobufs: read_bytes len = 0 (See jaspervdm/pogoprotos-php#4)
- Protobufs: did not read the full length (See jaspervdm/pogoprotos-php#5)
There are currently 2 implementations of the Google login (see #1):
- GoogleAuth: You have to provide your Google account credentials
- GoogleOAuth: You do not have to provide your Google account credentials, but do the Google OAuth process by entering a code on google.com/device (being logged in there)
If you login with GoogleOAuth you should catch \DrDelay\PokemonGo\Auth\DeviceNotVerifiedException
at the login call. It gets raised if a verification on the google website is needed.
See the message, and the getVerificationUrl
/ getUserCode
methods
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This project is in no way affiliated with, authorized, maintained, sponsored or endorsed by Niantic, The Pokémon Company, Nintendo or any of its affiliates or subsidiaries. This is an independent and unofficial API library. The contents of this repository are a proof of concept and are for educational use only. Using this project might be against Niantic's TOS.