Skip to content

andrewtweber/laravel-etsy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Etsy

Laravel Etsy

CircleCI

Installation

(This is not actually published yet, as it is in pre-alpha. I do not follow semantic versioning, so use at your own risk)

composer require andrewtweber/laravel-etsy

To publish the config and migrations, run:

php artisan vendor:publish --provider="Etsy\EtsyServiceProvider" 

User Model

Add the EtsyUserInterface interface and EtsyUser trait to your User class.

use Etsy\EtsyUser;
use Etsy\EtsyUserInterface;

class User extends Model implements EtsyUserInterface
{
    use EtsyUser;
}

API

Go to your Etsy developer account to get your API keys and add them to your .env

ETSY_API_KEY=
ETSY_API_SECRET=

Console Commands

Add the commands to your console Kernel.

protected $commands = [
    \Etsy\Console\Commands\EtsyTaxonomies::class,
    \Etsy\Console\Commands\EtsyUpdateListings::class,
];

protected function schedule(Schedule $schedule)
{
    // Recommend running this daily to sync shops and items
    $schedule->command('etsy:shops')->dailyAt('06:00');
}

Taxonomy

This command probably only needs to be run once, or very rarely:

php artisan etsy:taxonomy

This will fetch all of Etsy's taxonomies which can then be mapped to your own custom categories.

Extending Models

If you need to extend any of the Etsy models or pivots, you can do so and update the configuration to point to your model class.

Sample model:

namespace App\Models;

class Shop extends \Etsy\Models\Shop implements HasCommentsInterface
{
    use HasComments;
}

Config:

return [
    'models' => [
        'shop' => \App\Models\Shop::class,
    ],
];

Events

ShopItemPhotoFetched - when a new item is synced, this event gets dispatched which contains the shop item, the full URL to the image, and Etsy's external ID for that image. You can process this (save it to storage, etc) by listening for this event.

Recommendations

  • Make sure to add some policies for the Shop and ShopItem classes.
  • Some sample Nova models are supplied, copy them into your app/Nova folder.

TODO

  • Not sure if the observers can be registered in the package service provider, especially if the model classes are overridden.

About

Etsy marketplace integration for Laravel

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages