PHPackages                             dansmaculotte/laravel-prestashop-webservice - 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. dansmaculotte/laravel-prestashop-webservice

ActiveLibrary[API Development](/categories/api)

dansmaculotte/laravel-prestashop-webservice
===========================================

Laravel 5 wrapper for Prestashop Web Service Library

0297PHP

Since Sep 29Pushed 6y agoCompare

[ Source](https://github.com/dansmaculotte/laravel-prestashop-webservice)[ Packagist](https://packagist.org/packages/dansmaculotte/laravel-prestashop-webservice)[ RSS](/packages/dansmaculotte-laravel-prestashop-webservice/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Prestashop Web Service
==============================

[](#laravel-prestashop-web-service)

[![Latest Version](https://camo.githubusercontent.com/a33822fb66194f05d93a6be8559b349d511edf24b64a786e3c0f63b0712d0c0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64616e736d6163756c6f7474652f6c61726176656c2d70726573746173686f702d776562736572766963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dansmaculotte/laravel-prestashop-webservice)[![Total Downloads](https://camo.githubusercontent.com/834efc17101060c1c3d82720e4db90890cbb992c3320c0e94f7be0e2b90dbacc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64616e736d6163756c6f7474652f6c61726176656c2d70726573746173686f702d776562736572766963652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dansmaculotte/laravel-prestashop-webservice)[![Build Status](https://camo.githubusercontent.com/d31b096c79286d3778825ed261f4a1fa07cea4cb744f02c84ec57882babc13d6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f64616e736d6163756c6f7474652f6c61726176656c2d70726573746173686f702d776562736572766963652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/dansmaculotte/laravel-prestashop-webservice)[![Quality Score](https://camo.githubusercontent.com/14722bbe151d374ec326e458833bfe7961979c9065a6f3b6f61fce0df18f309b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f64616e736d6163756c6f7474652f6c61726176656c2d70726573746173686f702d776562736572766963652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/dansmaculotte/laravel-prestashop-webservice)[![Code Coverage](https://camo.githubusercontent.com/7c9cd5a83bc28bf8994268cfec7338d52a82a576ca2dc2c9a8cca4b392e19539/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f64616e736d6163756c6f7474652f6c61726176656c2d70726573746173686f702d776562736572766963652e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/dansmaculotte/laravel-prestashop-webservice)

> Laravel wrapper for Prestashop Web Service Library

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

[](#installation)

Require this package with composer using the following command:

```
composer require dansmaculotte/laravel-prestashop-webservice
```

Finally publish the configuration file using the artisan command

```
php artisan vendor:publish --provider="DansMaCulotte\PrestashopWebService\PrestashopWebServiceProvider"
```

Configuration
-------------

[](#configuration)

Open the published configuration file at `config/prestashop-webservice.php`:

```
return [
    'url' => 'http://domain.com',
    'token' => '',
    'debug' => env('APP_DEBUG', false)
];
```

Then populate the `url` field with the **root url** of the targeted Prestashop installation and `token` field with the API token obtained from Prestashop control panel in Web Service section. If `debug` is `true` Prestashop will return debug information when responding to API requests.

Usage
-----

[](#usage)

You may use the Prestashop Web Service wrapper in two ways:

### Using the dependency or method injection

[](#using-the-dependency-or-method-injection)

```
...
use DansMaCulotte\PrestashopWebService\PrestashopWebService;

class FooController extends Controller
{
    private $prestashop;

    public function __construct(PrestashopWebService $prestashop)
    {
        $this->prestashop = $prestashop;
    }

    public function bar()
    {
        $opt['resource'] = 'customers';
        $xml = $this->prestashop->get($opt);
    }
}
```

### Using the Facade

[](#using-the-facade)

```
...
use Prestashop;

...

public function bar()
{
    $opt['resource'] = 'customers';
    $xml = Prestashop::get($opt);
}
```

Prestashop Underlying library usage
-----------------------------------

[](#prestashop-underlying-library-usage)

You may find complete documentation and tutorials regarding Prestashop Web Service Library in the [Prestashop Documentation](http://doc.prestashop.com/display/PS16/Using+the+PrestaShop+Web+Service).

Helper methods
--------------

[](#helper-methods)

I've added some helper methods to reduce development time:

### Retrieving resource schema and filling data for posting

[](#retrieving-resource-schema-and-filling-data-for-posting)

You may call `getSchema()` method to retrieve the requested resource schema. You may then fill the schema with an associative array of data with `fillSchema()` method.

```
$xmlSchema = Prestashop::getSchema('categories'); //returns a SimpleXMLElement instance with the desired schema

$data = [
    'name' => 'Clothes',
    'link_rewrite' => 'clothes',
    'active' => true,
];

$postXml = Prestashop::fillSchema($xmlSchema, $data);

//The xml is now ready for being sent back to the web service to create a new category

$response = Prestashop::add(['resource' => 'categories', 'postXml' => $postXml->asXml()]);
```

#### Preserving not filled nodes from removal

[](#preserving-not-filled-nodes-from-removal)

The default behaviour for the `fillSchema` method is to remove the nodes that are not filled. If you want to preserve those nodes (typical update situation) put the third parameter as `false`

```
$putXml = Prestashop::fillSchema($xmlSchema, $data, false);
```

#### Removing specific nodes

[](#removing-specific-nodes)

When preserving unfilled nodes from removal you may specify some nodes to be removed as the fourth argument (this may be useful when updating a resource with some readonly nodes that would trigger error 400):

```
$putXml = Prestashop::fillSchema($xmlSchema, $data, false, ['manufacturer_name', 'quantity']);
//manufacturer_name and quantity only will be removed from the XML
```

#### Handling language values

[](#handling-language-values)

If the node has a language child you may use a simple string for the value if your shop has only one language installed.

```
/*
    xml node with one language child example
    ...

    ...
*/
$data = ['name' => 'Clothes'];
```

If your shops has more than one language installed you may pass the node value as an array where the key is the language ID.

```
/*
    xml node with n language children example
    ...

    ...
*/
$data = [
    'name' => [
        1 => 'Clothes',
        2 => 'Abbigliamento',
    ],
];
```

*Please note that if you don't provide an array of values keyed by the language ID all language values will have the same value.*

#### Handling associations with several siblings

[](#handling-associations-with-several-siblings)

Provided you got a node with several associations like category association for products or similar as from this extract of product schema:

```
...

...
```

You can prepare the array data map for the `fillSchema` method in this way:

```
$data => [
    ...
    'associations' => [
        'categories' => [
            [ 'category' => ['id' => 4] ],
            [ 'category' => ['id' => 5] ],
            [ 'category' => ['id' => 11] ],
        ],
        'product_features' => [
            [
                'product_feature' => [
                    'id' => 5,
                    'id_feature_value' => 94,
                ],
            ],
            [
                'product_feature' => [
                    'id' => 1,
                    'id_feature_value' => 2,
                ],
            ],
        ],
    ],
];
```

The result will be this as expected:

```
...

            4

            5

            11

            5
            94

            1
            2

...
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50.9% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/498465?v=4)[Gaël Reyrol](/maintainers/GaelReyrol)[@gaelreyrol](https://github.com/gaelreyrol)

![](https://www.gravatar.com/avatar/777575bd441b3393f38a0865d5365a071c18e0989b5a4c9fc90426217876085a?d=identicon)[romain-dmc](/maintainers/romain-dmc)

---

Top Contributors

[![Silentscripter](https://avatars.githubusercontent.com/u/11164238?v=4)](https://github.com/Silentscripter "Silentscripter (27 commits)")[![pimlie](https://avatars.githubusercontent.com/u/1067403?v=4)](https://github.com/pimlie "pimlie (13 commits)")[![gaelreyrol](https://avatars.githubusercontent.com/u/498465?v=4)](https://github.com/gaelreyrol "gaelreyrol (5 commits)")[![Turaylon](https://avatars.githubusercontent.com/u/618998?v=4)](https://github.com/Turaylon "Turaylon (2 commits)")[![fkwakkenbos](https://avatars.githubusercontent.com/u/1029218?v=4)](https://github.com/fkwakkenbos "fkwakkenbos (2 commits)")[![maronzu](https://avatars.githubusercontent.com/u/15518092?v=4)](https://github.com/maronzu "maronzu (1 commits)")[![basjac](https://avatars.githubusercontent.com/u/6992553?v=4)](https://github.com/basjac "basjac (1 commits)")[![alexszilagyi](https://avatars.githubusercontent.com/u/1736655?v=4)](https://github.com/alexszilagyi "alexszilagyi (1 commits)")[![PetrKcz](https://avatars.githubusercontent.com/u/34104609?v=4)](https://github.com/PetrKcz "PetrKcz (1 commits)")

---

Tags

laravelprestashopwebservice

### Embed Badge

![Health badge](/badges/dansmaculotte-laravel-prestashop-webservice/health.svg)

```
[![Health](https://phpackages.com/badges/dansmaculotte-laravel-prestashop-webservice/health.svg)](https://phpackages.com/packages/dansmaculotte-laravel-prestashop-webservice)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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