andyts93/laravel-ebay
Composer 安装命令:
composer require andyts93/laravel-ebay
包简介
Laravel package to integrate eBay REST API
README 文档
README
A Simple eBay implementation for Laravel.
⚠️ This package is under development.
Installation
Install the package through Composer.
composer require andyts93/laravel-ebay
Configuration
Publish the config file:
php artisan vendor:publish --tag=ebay-config
Follow the official eBay guide to create your keys and the test account. Edit your .env file to add these mandatory fields:
EBAY_CLIENT_ID=
EBAY_CLIENT_SECRET=
EBAY_RU_NAME=
Publish the migrations and migrate
php artisan vendor:publish --tag=ebay-migrations php artisan migrate
Model configuration
Use the EbayProduct trait in your product model. Define the sku column name in the function (if the column is named sku you can omit the function).
<?php use \Illuminate\Database\Eloquent\Model; use \Andyts93\LaravelEbay\Traits\EbayProduct; class Product extends Model { use EbayProduct; protected function getSkuKeyName(): string { return 'sku'; } ... }
Usage
1. Create inventory item
$product = Product::first(); $product->ebayCreateInventoryItem([ 'quantity' => $product->quantity, 'title' => Str::limit($product->name, 80, ''), 'description' => $product->description, 'aspects' => [ 'Brand' => [$product->brand], ], ], [ 'packageWeightAndSize' => [ 'weight' => [ 'unit' => 'KILOGRAM', 'value' => $product->weight, ] ], ]);
2. Create offer
$offer = $product->ebayCreateOffer([ 'category_id' => EBAY_CATEGORY_ID, 'price' => $product->price, ]);
3. Publish the offer
$offer->publishOffer();
Other functions
Get product's offers
$product->ebayListings()->get();
Update an offer
$offer->update([ 'category_id' => EBAY_CATEGORY_ID, 'price' => $product->price + 10.00, ]);
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-27