PHPackages                             debuss-a/spartoo - 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. debuss-a/spartoo

ActiveLibrary

debuss-a/spartoo
================

A wrapper for the Spartoo API.

1.1(6y ago)17881MITPHP

Since Mar 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/debuss/spartoo)[ Packagist](https://packagist.org/packages/debuss-a/spartoo)[ RSS](/packages/debuss-a-spartoo/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Spartoo API
===========

[](#spartoo-api)

Implementation of the [Spartoo](https://spartoo.com) API.
This API allows you to :

- Import products
- Quickly update stock
- Quickly update stock in batch
- Export online catalog
- Check product status
- Export orders
- Update orders
- Export delivery slips
- Export returns
- Update returns

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

[](#installation)

It is recommended to use [composer](https://getcomposer.org/) to install the package :

```
$ composer require debuss-a/spartoo

```

**PHP 7.2 or newer is required.**

Usage
-----

[](#usage)

First of all you need your Merchant ID for webservices to use the API.
It is available on [your seller account](https://www.spartoo.fr/mp/informations.php), then you can instantiate the app :

```
require_once __DIR__.'/vendor/autoload.php';

$app = new Spartoo\App('EF40F969744AF620');
```

*Every method of Spartoo\\App return an instance of `SimpleXMLElement` containing the response from Spartoo.*

### Create products

[](#create-products)

```
require_once __DIR__.'/vendor/autoload.php';

use Spartoo\App;
use Spartoo\Factory;

$app = new App('EF40F969744AF620');

$products = [
    Factory::getProduct('98', 'ALL STAR HI', 'Converse', 64.99)
        ->setProductSex('M')
        ->setProductQuantity(5)
        ->setColorId(8)
        ->setProductStyle(10059)
        ->setProductDescription(
            'Mythique parmi les mythiques, la Chuck Taylor All Star de Converse est une incontournable. Ici en version montante avec une tige en toile et un imprimé uni classique, elle se la joue intemporelle et indémodable !'
        )
        ->setProductColor('Rouge')
        ->setSizeList([
            Factory::getSize('38', 4, '98_38', '123456789011'),
            Factory::getSize('39', 1, '98_39', '123456789012')
        ])
        ->setProductComposition(1)
        ->setPhotos([
            'https://imgext.spartoo.com/photos/98/98/98_350_A.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_B.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_C.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_D.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_E.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_F.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_G.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_H.jpg'
        ])
        ->setDiscount(Factory::getDiscount(
            time(),
            time() + 60 * 60 * 24 * 31,
            null,
            20,
            false
        )),
    // Other products ...
];

$app->importProducts($products);
```

### Create multi country products

[](#create-multi-country-products)

```
require_once __DIR__.'/vendor/autoload.php';

use Spartoo\App;
use Spartoo\Factory;

$app = new App('EF40F969744AF620');

$products = [
    Factory::getProductMultiCountry([
            Factory::getLanguage(
                'FR',
                'ALL STAR HI',
                'Mythique parmi les mythiques, la Chuck Taylor All Star de Converse est une incontournable. Ici en version montante avec une tige en toile et un imprimé uni classique, elle se la joue intemporelle et indémodable !',
                'Rouge',
                64.99
            ),
            Factory::getLanguage(
                'ES',
                'ALL STAR HI',
                'Mítico entre los míticos, el Chuck Taylor All Star of Converse es un must have. Aquí, en una versión ascendente con un tallo de lienzo y una impresión lisa clásica, ¡es intemporal y atemporal!',
                'Rojo',
                64.99
            ),
        ], 'Converse')
        ->setReferencePartenaire('98')
        ->setProductSex('M')
        ->setProductQuantity(5)
        ->setColorId(8)
        ->setProductStyle(10059)
        ->setSizeList([
            Factory::getSize('38', 4, '98_38', '123456789011'),
            Factory::getSize('39', 1, '98_39', '123456789012')
        ])
        ->setProductComposition(1)
        ->setPhotos([
            'https://imgext.spartoo.com/photos/98/98/98_350_A.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_B.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_C.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_D.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_E.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_F.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_G.jpg',
            'https://imgext.spartoo.com/photos/98/98/98_350_H.jpg'
        ]),
    // Other multi country products ...
];

$app->importProducts($products);
```

### Quickly update a product

[](#quickly-update-a-product)

```
$partner_reference = 'demo_01';
$product_size_reference = 'demo_01_01';
$quantity = 42;

$app->majStock($partner_reference, $product_size_reference, $quantity);
```

### Quickly update products in batch

[](#quickly-update-products-in-batch)

```
$products = [
    Factory::getProduct('98', 'ALL STAR HI', 'Converse', 64.99)
            ->setSizeList([
                Factory::getSize('38', 4, '98_38'),
                Factory::getSize('39', 1, '98_39')
            ]),
    Factory::getProduct('99', 'Continental', 'Adidas', 90.99)
            ->setSizeList([
                Factory::getSize('40', 12, '99_40'),
                Factory::getSize('41', 3, '99_41')
            ]),
    // Other products ...
];

$app->majStockBatch($products);
```

### Export products in catalog

[](#export-products-in-catalog)

```
$products = $app->exportProducts();
```

### Check products status

[](#check-products-status)

```
$products = [
    Factory::getProduct('98', 'ALL STAR HI', 'Converse', 64.99)
            ->setSizeList([
                Factory::getSize('38', 4, '98_38'),
                Factory::getSize('39', 1, '98_39')
            ]),
    Factory::getProduct('99', 'Continental', 'Adidas', 90.99)
            ->setSizeList([
                Factory::getSize('40', 12, '99_40'),
                Factory::getSize('41', 3, '99_41')
            ]),
    // Other products ...
];

$results = $app->checkStatusProducts($products);
```

### Export orders list

[](#export-orders-list)

```
$orders = $app->exportOrders(new DateTime('2020-03-01'));
```

### Export delivery slip

[](#export-delivery-slip)

```
$product = Factory::getProduct('98', 'ALL STAR HI', 'Converse', 64.99)
    ->setProductQuantity(1);

$delivery_slip = $app->exportBL('my_order_id', $product);
```

### Export returns

[](#export-returns)

```
$returns = $app->exportReturns(new DateTime('2020-03-01'));
```

### Update a return

[](#update-a-return)

```
$app->majReturns('return_id', 3, 'https://example.com/my/return/label.pdf');
```

### Provisionning

[](#provisionning)

You can get provisionning data from the `Provionning` class, default language is french but you can set an other one or switch to another one.

```
require_once __DIR__ . '/vendor/autoload.php';

use Spartoo\Provisionning;

var_dump(
    Provisionning::getInstance()->getLanguages(),
    Provisionning::getInstance()->getProductsSex(),
    Provisionning::getInstance()->getColors(),
    Provisionning::getInstance()->switchLanguage('IT')->getColors(),
    Provisionning::getInstance()->switchLanguage('ES')->getColors(),
    Provisionning::getInstance()->switchLanguage('FR')->getCompositions(),
    Provisionning::getInstance()->getCategories(),
    Provisionning::getInstance()->getSelections(),
    Provisionning::getInstance()->getExtraInfos(),
    Provisionning::getInstance()->getOrdersStatus(),
    Provisionning::getInstance()->getReturnsStatus(),
    Provisionning::getInstance()->getSizes(),
    Provisionning::getInstance()->getCurrencies(),
    Provisionning::getInstance()->getInvoiceTypes(),
    Provisionning::getInstance()->getProductStyles()
);
```

License
-------

[](#license)

The package is licensed under the MIT license. See [License File](https://github.com/debuss/spartoo/blob/master/LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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 ~20 days

Total

2

Last Release

2245d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e1a70117520fe10a630d61c750bbe6888d174e9903825e741470f818ee2c5d1?d=identicon)[debuss-a](/maintainers/debuss-a)

### Embed Badge

![Health badge](/badges/debuss-a-spartoo/health.svg)

```
[![Health](https://phpackages.com/badges/debuss-a-spartoo/health.svg)](https://phpackages.com/packages/debuss-a-spartoo)
```

PHPackages © 2026

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