Looking to hire Laravel developers? Try LaraJobs

laravel-ebay maintained by andyts93

Description
Laravel package to integrate eBay REST API
Last update
2025/11/04 17:34 (dev-main)
License
Links
Downloads
1

Comments
comments powered by Disqus

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,
]);