PHP code example of neetfreya / trendyol-php-api

1. Go to this page and download the library: Download neetfreya/trendyol-php-api 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/ */

    

neetfreya / trendyol-php-api example snippets


use Trendyol\Client\TrendyolClient;
use Trendyol\Services\ProductIntegration\ProductService;

$client = new TrendyolClient('username', 'password', 'supplierId');
$productService = new ProductService($client);

// Get all products
$products = $productService->getProducts(['page' => 1, 'size' => 50]);
print_r($products);

use Trendyol\Client\TrendyolClient;
use Trendyol\Services\OrderIntegration\OrderService;

$client = new TrendyolClient('username', 'password', 'supplierId');
$orderService = new OrderService($client);

// Get all orders
$orders = $orderService->getOrders(['status' => 'Created']);
print_r($orders);

use Trendyol\Client\TrendyolClient;
use Trendyol\Services\ClaimIntegration\ClaimService;

$client = new TrendyolClient('username', 'password', 'supplierId');
$claimService = new ClaimService($client);

// Get all return orders
$returnOrders = $claimService->getReturnedOrders();
print_r($returnOrders);

use Trendyol\Client\TrendyolClient;
use Trendyol\Services\QuestionAnswerIntegration\QuestionAnswerService;

$client = new TrendyolClient('username', 'password', 'supplierId');
$questionAnswerService = new QuestionAnswerService($client);

// Get customer questions
$questions = $questionAnswerService->getCustomerQuestions();
print_r($questions);