PHPackages                             nhupham-commonservices/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. nhupham-commonservices/spartoo

ActiveLibrary

nhupham-commonservices/spartoo
==============================

A wrapper for the Spartoo API.

1.0.7(11mo ago)083↓100%MITPHP

Since Sep 26Pushed 10mo agoCompare

[ Source](https://github.com/nhupham-commonservices/spartoo)[ Packagist](https://packagist.org/packages/nhupham-commonservices/spartoo)[ RSS](/packages/nhupham-commonservices-spartoo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (7)Used By (0)

Spartoo API (Fork a repo)
=========================

[](#spartoo-api-fork-a-repo)

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 nhupham-commonservices/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

32

—

LowBetter than 72% of packages

Maintenance53

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.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 ~125 days

Recently: every ~155 days

Total

6

Last Release

330d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a48828cee4f5e06da551b0409ecca56c88ff93ec5e123455886bbcb3adbe66e?d=identicon)[nhupham-commonservices](/maintainers/nhupham-commonservices)

![](https://avatars.githubusercontent.com/u/166588587?v=4)[Lê Đức Tâm](/maintainers/ceres-ductamle)[@ceres-ductamle](https://github.com/ceres-ductamle)

---

Top Contributors

[![nhupham-commonservices](https://avatars.githubusercontent.com/u/110216013?v=4)](https://github.com/nhupham-commonservices "nhupham-commonservices (15 commits)")[![nhupham-intersoft](https://avatars.githubusercontent.com/u/127480975?v=4)](https://github.com/nhupham-intersoft "nhupham-intersoft (1 commits)")[![tran-cs](https://avatars.githubusercontent.com/u/65382487?v=4)](https://github.com/tran-cs "tran-cs (1 commits)")

### Embed Badge

![Health badge](/badges/nhupham-commonservices-spartoo/health.svg)

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

PHPackages © 2026

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