dev-master
9999999-devLibrary to integrate Shopify with Laravel
The Requires
The Development Requires
by Rob Wittman
v1.0.0-alpha.1
1.0.0.0-alpha1Library to integrate Shopify with Laravel
The Requires
The Development Requires
by Rob Wittman
Wallogit.com
2017 © Pedro Peláez
Library to integrate Shopify with Laravel
This library integrates the Shopify API with your Laravel application., (*2)
composer require robwittman/laravel-shopify-plugin php artisan vendor:publish
By default, the package exposes /shopify/install for app installation, and shopify/uninstall to listen for the app uninstalled webhook., (*3)
The config file for this library is located at /config/shopify.php. This must be filled out using the details from your app in the Shopify Partners dashboard., (*4)
The credential Shopify gives your application for access, (*5)
Wether or not your app is embedded. Embedded apps load inside Shopify's admin panel, (*6)
If you initialize the embedded app, and are not in Shopify's admin panel IFrame, should the app automatically redirect, (*7)
The URL Shopify should send stores to after they authenticate your application, (*8)
The scopes we want to ask the store owner for, (*9)
An array of webhooks we should automatically install. If the array key is just the webhook, we automatically register domain.com/shopify/<topic> as the webhook destination. If the array is associative, we'll use the specified route. If you supply an array of routes, we'll install each one. NOTE Relative URLs will use the current app domain. Also, we recommend at least the app/uninstalled webhook being set, so the app is notified when someone uninstalls, (*10)
<?php
# domain = 'https://app.com';
'webhooks' => array(
'shop/update',
'app/uninstalled' => 'my/custom/webhook',
'products/create' => array(
'endpoint1',
'https://custom-api.com/products/create'
)
);
?>
This will install the following., (*11)
| Topic | Webhook Destination |
|---|---|
shop/update |
https://app.com/shopify/shop/update |
app/uninstalled |
https://app.com/my/custom/webhook |
products/create |
https://app.com/endpoint1 |
products/create |
https://custom-api.com/products/create |
Script tags are URLs that Shopify should automatically load when an installed stores storefront is opened. These run on the customer facing store. NOTE Relative URLs will use the current app domain., (*12)
<?php
#domain => 'https://app.com';
'script_tags' => array(
'/js/script.js', # installs https://app.com/js/script.js
'https://cdn.com/js/script2.js' # installs https://cdn.com/js/script2.js'
);
?>
ShopInstalledTriggered anytime a new store authenticates with your application. This plugin includes 2 listeners that install required webhooks and script tags. You can also use this to send E-mails, persist the store to database, start tenant requirements, etc., (*13)
To register the bundled webhooks, you can start with this, (*14)
<?php
protected $listen = [
'LaravelShopifyPlugin\Events\ShopInstalled' => [
'LaravelShopifyPlugin\Listeners\InstallWebhooks',
'LaravelShopifyPlugin\Listeners\InstallScriptTags'
],
];
AppUninstalledTriggered anytime a store uninstalls your app. Use it to do any last cleanup before saying goodbye., (*15)
Library to integrate Shopify with Laravel
Library to integrate Shopify with Laravel