PHPackages                             mcrock/allegroapi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mcrock/allegroapi

ActiveLibrary[API Development](/categories/api)

mcrock/allegroapi
=================

library making allegro rest and soap api using easier

4.0.8(7y ago)0151MITPHPPHP &gt;=7.1.0

Since Jun 26Pushed 7y agoCompare

[ Source](https://github.com/mcrock/allegroapi)[ Packagist](https://packagist.org/packages/mcrock/allegroapi)[ RSS](/packages/mcrock-allegroapi/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (32)Used By (0)

allegroapi PHP SDK
==================

[](#allegroapi-php-sdk)

Library that makes allegro rest and soap api using easier

Installation
------------

[](#installation)

This lib should be installed with composer

```
composer require mcrock/allegroapi
```

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1 (please forgive me, i think it's time to say goodbye to PHP5)

REST Api usage
--------------

[](#rest-api-usage)

Usage of allegro rest api is very simple with this library.

### Prepare credentials

[](#prepare-credentials)

First, you should create object Credentials, or implement CredentialsInterface in your own class.

```
$credentials = new Credentials([
    'restClientId' => 'yourClientId',
    'restClientSecret' => 'yourClientSecret',
    'restApiKey' => 'yourApiKey',
    'restRedirectUri' => 'yourRedirectUri',
    'soapApiKey' => 'yourSoapApiKey',
]);
```

### Get your token

[](#get-your-token)

Every operation in REST Api needs OAuth token. You can easily get it with this library.

```
$client = new RestClient($credentials);
$authService = $client->getAuthService();

//now redirect to URL generated from this method:
header('Location: '.$authService->getAuthUrl());
```

After logging in Allegro.pl you will be redirected to your RedirectUrl with auth code in query string. What next?

```
$code = $_GET['code'];

$token = $authService->getNewToken($code);
```

You can store Token serializing it, or storing it's values. You can also implement TokenInterface to create a solution that suits your needs.

If your token has expired, just generate new one with this method:

```
$newToken = $authService->refreshToken($token);
```

### Usage of API methods

[](#usage-of-api-methods)

The best explanation how to use it will be some example, so here it is:

```
$request = new Request('GET', 'pricing/offer-quotes', null, ['offer.id' => '123123123']);
$response = $client->sendRequest($token, $request);

var_dump(json_decode((string) $response->getBody()));
```

With that simple way you can use all api methods. Alternative method is use prepared request classes.

Ready-to-use request classes location: [here](src/mcrock/AllegroApi/Rest/Model/Request)I already covered almost all rest api methods. I'll try to create all to cover 100%.

Of course you can create your own, just implement RequestInterface. It's very simple.

Example:

```
$request = new PutChangePriceCommandRequest('123123123', '123.45');
$response = $client->sendRequest($token, $request);

var_dump(json_decode((string) $response->getBody()));
```

Exceptions
----------

[](#exceptions)

I've created two Exception classes: InvalidRequestMethodException - just means that you used wrong HTTP method name in your request. UnauthorizedClientException - you should catch it just to know when refreshing token is necessary.

SOAP API
--------

[](#soap-api)

There is a class AllegroApiSoapClient inside this lib, and you can use it, by so far I got no time to finish it. It should work ok, but I need some time to document it.

Sandbox
-------

[](#sandbox)

Allegro Api Sandbox is problematic. It almost never works properly, so if you want to test your app, just use production API. Trust me, there is no good reason to implement Sandbox endpoints :)

Few ending words
----------------

[](#few-ending-words)

If you have any suggestions, or noticed any issues, feel free to report it, or contact me.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 87.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~14 days

Recently: every ~0 days

Total

31

Last Release

2828d ago

Major Versions

1.1.3 → 2.0.02018-02-28

2.0.1 → 3.0.02018-03-04

1.1.4 → v3.x-dev2018-04-07

3.0.3 → 4.0.02018-08-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0e24190e68c0f8e02d94a3a22733b6a57c6db6c20da67cffb385daaf688ef22?d=identicon)[mcrock](/maintainers/mcrock)

---

Top Contributors

[![imper86](https://avatars.githubusercontent.com/u/16724155?v=4)](https://github.com/imper86 "imper86 (41 commits)")[![mcrock](https://avatars.githubusercontent.com/u/43232193?v=4)](https://github.com/mcrock "mcrock (4 commits)")[![mackodev](https://avatars.githubusercontent.com/u/39956016?v=4)](https://github.com/mackodev "mackodev (2 commits)")

### Embed Badge

![Health badge](/badges/mcrock-allegroapi/health.svg)

```
[![Health](https://phpackages.com/badges/mcrock-allegroapi/health.svg)](https://phpackages.com/packages/mcrock-allegroapi)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[fschmtt/keycloak-rest-api-client-php

PHP client to interact with Keycloak's Admin REST API.

4684.7k2](/packages/fschmtt-keycloak-rest-api-client-php)[commercetools/commercetools-sdk

The official PHP SDK for the commercetools Composable Commerce APIs

19281.5k](/packages/commercetools-commercetools-sdk)[mvdnbrk/dhlparcel-php-api

DHL Parcel API client for PHP

3957.9k5](/packages/mvdnbrk-dhlparcel-php-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
