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

Installation v1.x.x

Tyler King edited this page Jan 26, 2018 · 1 revision

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,

This ensures you can override the default routes.

Note: This package has a built in / (home) route. In your routes/web.php you can comment out Laravel's default home route so this packages' route can load.


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,

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 migrate

Configuration

Package

php artisan vendor:publish

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.

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.