PHP code example of afosto / fashion-partner

1. Go to this page and download the library: Download afosto/fashion-partner library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

afosto / fashion-partner example snippets


$config = [
    'wsdl'        => '',
    'user'        => '',
    'password'    => '',
    'companyCode' => '',
];

App::init($config); 

$webhook = new Afosto\FashionPartner\Models\Webhooks\Webhook();
$webhook->event = $webhook::HOOK_STOCK;
$webhook->name = 'TestWebhook';
$webhook->address = 'https://myapp.test/bucket.php';

if (!$webhook->push()) {
    print_r($webhook->errors); 
} else {
    echo $webhook->getWebhookId();
}

$bucket = new \Afosto\FashionPartner\Helpers\Bucket();
$hook = $bucket->getStock();


foreach ($hook->list as $stock) {
    echo "New stock for {$stock->barcode} is {$stock->quantity}";
}