Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Installation v2.x.x

Tyler King edited this page Jul 20, 2018 · 1 revision

For v2.x.x, for v1.x.x click here.


First off, the best way is to use Composer to grab the code:

composer require ohmybrew/laravel-shopify

This will download laravel-shopify for Laravel >= 5.5.

Providers

Open config/app.php find providers array. Find a line with:

App\Providers\RouteServiceProvider::class,

Before it, add a new line with:

\OhMyBrew\ShopifyApp\ShopifyAppProvider::class,

Note: This package has a built in / (home) route.


Facades

Open config/app.php find aliases array. Add a new line with:

'ShopifyApp' => \OhMyBrew\ShopifyApp\Facades\ShopifyApp::class,

Middlewares

Open app/Http/Kernel.php find routeMiddleware array. Add a new line with:

'auth.shop' => \OhMyBrew\ShopifyApp\Middleware\AuthShop::class,
'auth.webhook' => \OhMyBrew\ShopifyApp\Middleware\AuthWebhook::class,
'auth.proxy' => \OhMyBrew\ShopifyApp\Middleware\AuthProxy::class,
'billable' => \OhMyBrew\ShopifyApp\Middleware\Billable::class,

Jobs

Recommendations

By default Laravel uses the sync driver to process jobs. These jobs run immediately and synchronously (blocking).

This package uses jobs to install webhooks, scripttags, and an option after-install hook if any are defined in the configuration. If you do not have any after-install hooks, scripttags, or webhooks to install on the shop, you may skip this section.

If you do however, you can leave the sync driver as default. But, it may impact load times for the customer accessing the app. Its recommended to setup Redis or database as your default driver in config/queue.php so jobs can run in the background and not affect the frontend performance. See Laravel's docs on setting up queue drivers.

For more information on creating webhooks, see Creating Webhooks of this wiki or After Authentication Job.


Migrations

php artisan vendor:publish --tag=migrations && php artisan migrate

Configuration

Package

php artisan vendor:publish --tag=config

You're now able to access config in config/shopify-app.php.

Essentially you will need to fill in the app_name, api_key, api_secret, and api_scopes to generate a working app. Items like webhooks and scripttags are completely optional depending on your app requirements. As well, anything to do with billing is also optional, and is disabled by default.

Its recommended you use an env file for the configuration.


Shopify App

In your app's settings on your Shopify Partner dashboard, you need to set the callback URL to be:

https://(your-domain).com/

And the redirect_uri to be:

https://(your-domain).com/authenticate

The callback URL will point to the home route, while the redirect_uri will point to the authentication route.

ESDK & Legacy

By default ESDK is enabled, the embeddable mode for Shopify Apps. If you wish to disable this, set SHOPIFY_ESDK_ENABLED=0 for your environment variable. This will enabled legacy mode and skip any ESDK modes.