shamran / easydaraz
A package to make api endpoint calls to daraz e-commerce site for sellers
Requires
- spatie/array-to-xml: ^2.11
Requires (Dev)
- guzzlehttp/guzzle: ^7.0@dev
This package is auto-updated.
Last update: 2025-03-04 22:31:56 UTC
README
This is a package created to make api endpoint calls to Daraz e-commerce site for sellers.
How to initiate?
- Git Clone the repository
- Update the Composer
- Use these in your file
require_once(dirname(__FILE__) . '/vendor/autoload.php'); require_once(dirname(__FILE__) . '/src/Daraz.php'); use daraz\easydaraz\Daraz;
- Define following variables in your code.
$apiKey = 'Your Daraz API-Key'; $userId = 'Your E-mail'; $url = 'Your Daraz API URL';
ex: https://api.sellercenter.daraz.lk - for Sri Lanka
- Instantiate the class
$daraz = new Daraz($userId, $apiKey, $url);
Available API Endpoints
Use these calls to get required results. Get complete information on Daraz API here.
-
getSeller()
- To get seller information by the current user ID. -
getCategoryTree()
- Retrieve the list of all product categories in the system. -
getCategoryAttributes()
- Get a list of attributes with options for a given category. -
getBrands()
- Retrieve all product brands in the system. -
createProduct()
- Create a product (use an array of attributes). -
updateProduct()
- Update attributes or SKUs of an existing product. One request can update only 1 product. -
uploadImage()
- To upload a single image file and accept binary stream with file content. -
migrateImage()
- To migrate a single image from an external site to Daraz site (Response provides migrated Image URLs). -
migrateImages()
- To migrate multiple images from an external site to Daraz site (This call's response doesn't provide migrated image URLs). -
getResponse()
- To get the returned information from the system for the UploadImages and MigrateImages API -
getAllProducts()
- Get all or a range of products. -
getProducts()
- To get all or a range of products. -
setImages()
- To set the images for an existing product by associating one or more image URLs with it. -
updatePriceQuantity()
- To update the price and quantity of one or more existing products. -
getOrder()
- To get the order details for a single order. -
getOrders()
- To get the customer details for a range of orders. -
getOrderItems()
- To get the item information of one or more orders. -
getMultipleOrderItems()
- To get the item information of one or more orders. -
setInvoiceNumber()
- To set the invoice access key. -
setStatusToPackedByMarketplace()
- To mark order items as being packed. -
setStatusToReadyToShip()
- To mark an order item as being ready to ship. -
getDocument()
- To retrieve order-related documents, including invoices, shipping labels, and shipping parcels. -
getFailureReasons()
- To get additional error context for SetStatusToCanceled. -
setStatusToCanceled()
- To cancel a single item. -
getQCStatus()
- To get the quality control status of items being listed. -
getPayoutStatus()
- To get the payout status for a specified period. -
getTransactionDetails()
- To get transaction or fee details for a specified period.
Example Array
$addProductArray = [ 'Product' => [ 'PrimaryCategory' => '9098', 'SPUId' => '', 'AssociatedSku' => '', 'Attributes' => [ 'name' => 'T-800 Terminator', 'short_description' => 'Premium Skynet Product', 'brand' => 'Skynet', 'model' => '', ], 'Skus' => [ 'Sku' => [ 'SellerSku' => 'sudo_T800_init', 'color_family' => 'Black', 'quantity' => '1000', 'price' => '20000', 'package_length' => '10', 'package_height' => '10', 'package_width' => '10', 'package_weight' => '1', 'package_content' => '', 'Images' => [ 'Image' => [ "https://static-01.daraz.lk/p/8ef1381b408720516321407d91bd2a8f.jpg", ] ], ], ], ], ];