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

ActiveLibrary[API Development](/categories/api)

shabeer/laravel-prestashop-webservice
=====================================

Laravel 5 wrapper for Prestashop Web Service Library

3.5.2(5y ago)01.5k↓33.3%MITPHP

Since Apr 16Pushed 5y agoCompare

[ Source](https://github.com/muhammed-shabeer/laravel-prestashop-webservice)[ Packagist](https://packagist.org/packages/shabeer/laravel-prestashop-webservice)[ RSS](/packages/shabeer-laravel-prestashop-webservice/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (25)Used By (0)

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

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

Laravel 5 wrapper for Prestashop Web Service Library

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

[](#installation)

Require this package with composer using the following command:

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

After updating composer, add the service provider to the `providers` array in `config/app.php`

```
Protechstudio\PrestashopWebService\PrestashopWebServiceProvider::class,
```

You may also add the Facade in the `aliases` array in `config/app.php`

```
'Prestashop' => Protechstudio\PrestashopWebService\PrestashopWebServiceFacade::class,
```

Finally publish the configuration file using the artisan command

```
php artisan vendor:publish --provider="Protechstudio\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 Protechstudio\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

...
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity73

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~78 days

Recently: every ~182 days

Total

24

Last Release

1875d ago

Major Versions

1.2.4 → 2.0.02016-04-28

2.4.1 → 3.0.02017-09-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c657e8d2f647403f5c9e597fda79bba00f2bd620eb54a0a29328759803fcb3a?d=identicon)[shabeer-mdy](/maintainers/shabeer-mdy)

---

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)")[![muhammed-shabeer](https://avatars.githubusercontent.com/u/78337706?v=4)](https://github.com/muhammed-shabeer "muhammed-shabeer (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)")[![PetrKcz](https://avatars.githubusercontent.com/u/34104609?v=4)](https://github.com/PetrKcz "PetrKcz (1 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)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/shabeer-laravel-prestashop-webservice/health.svg)](https://phpackages.com/packages/shabeer-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)
