-
-
Notifications
You must be signed in to change notification settings - Fork 116
Installation v3.1.x
For v3.1.x, for v3.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
.
With Laravel's auto-discover feature, this is handled for you on install.
Please note, to see this packages' "success page", you will need to open routes/web.php
and comment out the home route. You are free to also leave it, and build your own route (see Override and Extending)
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,
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.
There is a default job provided which soft deletes the shop, and its charges (if any) for you. You're able to install this job directly or extend it.
To install, first run:
php artisan vendor:publish --tag=jobs
a job will be placed in App/Jobs/AppUninstalledJob
.
Next, edit config/shopify-app.php
to enable the job:
'webhooks' => [
[
'topic' => env('SHOPIFY_WEBHOOK_1_TOPIC', 'app/uninstalled'),
'address' => env('SHOPIFY_WEBHOOK_1_ADDRESS', 'https://(your-domain).com/webhook/app-uninstalled')
],
],
Use your environment file to replace the values, such as the domain, but set the topic to app/uninstalled
and the path as /webhook/app-uninstalled
will allow the webhook manager to do the heavy lifting for you.
php artisan vendor:publish --tag=migrations && php artisan migrate
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.
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.
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.