Download the PHP package codeinternetapplications/shopify-oauth without Composer
On this page you can find all versions of the php package codeinternetapplications/shopify-oauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codeinternetapplications/shopify-oauth
More information about codeinternetapplications/shopify-oauth
Files in codeinternetapplications/shopify-oauth
Package shopify-oauth
Short Description Oauth 2.0 authentication for Shopify apps
License MIT
Homepage https://github.com/codeinternetapplications/shopify-oauth
Informations about the package shopify-oauth
Shopify Oauth connector
This packages enables you to make an OAuth connection with Shopify.
The package was originally written to use with Lumen. But it can also be used in combination with Laravel. Note that since it was made for Lumen the connector is stateless.
Installation
Use composer to install this package into your project
Configuration
We tried to make it as easy as possible. Perform these steps to start:
Copy config file
Copy the shopify_oauth.php
config file to your config directory and make it available in the bootstrap/app.php
file.
Adjust your keys in the config
Set your api_key
, api_secret_key
and base_url
. Also adjust your scopes
. You can use the .env
file for this (see below)
Make sure your app supports Facades and Eloquent
In Lumen you will have to uncomment these lines in bootstrap/app.php
:
Environment file
Put these variables in your .env
file:
Also make sure that your APP_KEY
is defined. Since we encrypt some data in the database Lumen/Laravel needs this key to encrypt it.
Register the ShopifyOauthServiceProvider
Register the ShopifyOauthServiceProvider
in your application.
Run migrations
Run the migrations so you get the con_shops
and con_shop_access_tokens
table.
Usage of Middleware
Make sure that when you want to use the online token
you will have to add the Middleware shopify-oauth-handler
.
It is advisable to use these middlewares in your routes:
- shopify-hostname-validation
- shopify-hmac-validation
- shopify-oauth-handler
For example:
Execute scripts after installation
To install webhooks or trigger something right after the installation of the application you will have to implement an event listener into your app.
When the App is installed an event is triggered. You can listen to this event and implement custom actions such as:
- Install webhooks
- Trigger some data imports
Create listener and listen
Open your bootstrap/app.php
file and make sure that the EventServiceProvider
is enabled.
Open the EventServiceProvider.php
file and add these lines:
Create a new local listener in your app/Listeners
folder and add the scripts you want to perform. You can start with this template: