PHP-AllegroApi
A newest library to communicate with Allegro Api. The library is OOP, good tested and easy to use. Make your job enjoyable. The version is tested with PHP5.5, (*1)
Documentation
In this section I describe a class and methods you should use, (*2)
Configuration
To run test you must insert you login, password and appkey to Config/config.ini file., (*3)
login = "Insert your login here"
password = "Insert your password here - never do it in production"
apikey = "Insert your apikey here"
sandbox = false
countryCode = 1
The file is use only by tests., (*4)
You can create your access data by http://allegro.pl/myaccount/webapi.php/ page.
sandbox is use to switch allegro sandbox and production version. countryCode is used to select current country. Default 1 mean Poland. If you want you can change country to communication with other allegroGroup services like: aukro.cz, molotok.ru, aukro.ua, teszvesz.hu, (*5)
Security
Never storage your plain password. Your app should always hash it by sha256 (used by allegro), (*6)
$hashPassword = base64_encode(hash('sha256', YOUR_ALLEGRO_PASSWORD, true));
Class AllegroApi
AllegroApi is main class. Provide api access interface., (*7)
Constructor
Require one object with login, hashPassword (or password - strongly no recomended), apikey, sandbox, countryCode fields. The data is use to init connections., (*8)
LoginEnc
Login to allegro (use constructor data), (*9)
Run functions
The api use _call to maping functions names to allegro request. You should use short names without "do". Use getCountries (to rum allegro doGetCountries function)., (*10)
$allegroApi = new AllegroApi($config);
$countrisResponse = $allegroApi->getCountries();
Allegro functions documentation
Description of all allegro functions are available on http://allegro.pl/webapi/documentation.php, (*11)
Quick start
Clone empty project:, (*12)
git clone https://github.com/SebastianPozoga/PHP-AllegroApi-EmptyProject.git
composer install
And run:, (*13)
php index.php
Tests
Run tests by:, (*14)
phpunit tests/AllegroApiTest
Older version
It is strong recomended to use new version of PHP Allegro Api Library. If you must use old version is available on https://github.com/SebastianPozoga/Allegro-PHP-API-14, (*15)