Download the PHP package protechstudio/laravel-prestashop-webservice without Composer
On this page you can find all versions of the php package protechstudio/laravel-prestashop-webservice. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download protechstudio/laravel-prestashop-webservice
More information about protechstudio/laravel-prestashop-webservice
Files in protechstudio/laravel-prestashop-webservice
Package laravel-prestashop-webservice
Short Description Laravel 5 wrapper for Prestashop Web Service Library
License MIT
Informations about the package laravel-prestashop-webservice
Laravel Prestashop Web Service
Laravel 5 wrapper for Prestashop Web Service Library
Installation
Require this package with composer using the following command:
After updating composer, add the service provider to the providers
array in config/app.php
You may also add the Facade in the aliases
array in config/app.php
Finally publish the configuration file using the artisan command
Configuration
Open the published configuration file at config/prestashop-webservice.php
:
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
You may use the Prestashop Web Service wrapper in two ways:
Using the dependency or method injection
Using the Facade
Prestashop Underlying library usage
You may find complete documentation and tutorials regarding Prestashop Web Service Library in the Prestashop Documentation.
Helper methods
I've added some helper methods to reduce development time:
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.
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
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):
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.
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.
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
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:
The result will be this as expected: