Building a Shopify app with Laravel is one of the most rewarding projects you can take on as a PHP developer. The combination of Laravel's elegant syntax and Shopify's powerful ecosystem gives you everything you need to create a world-class e-commerce integration.

Prerequisites

Before we dive in, make sure you have the following set up:

  • A Shopify Partner account (free to create)
  • Laravel 5.6+ installed locally
  • Composer and Node.js on your machine
  • A basic understanding of OAuth 2.0

Setting Up Your Shopify Partner Account

Head over to partners.shopify.com and create a free partner account. Once you're in, create a new app from your Partner Dashboard. You'll get an API key and secret — keep these safe, you'll need them shortly.

Creating Your Laravel Application

Start with a fresh Laravel install:

composer create-project --prefer-dist laravel/laravel shopify-app
cd shopify-app

Next, install the ohmybrew/laravel-shopify package which does a lot of the OAuth heavy lifting for us:

composer require ohmybrew/laravel-shopify

Configuring OAuth

Shopify uses OAuth 2.0 to authenticate your app. When a merchant installs your app from the Shopify App Store, Shopify redirects them to your app with a temporary code. Your app exchanges that code for a permanent access token.

Always store access tokens securely. Never commit them to version control or expose them in client-side code.

Add your Shopify credentials to your .env file:

SHOPIFY_API_KEY=your_api_key_here
SHOPIFY_API_SECRET=your_api_secret_here
SHOPIFY_APP_NAME="My Awesome App"

Building the App Bridge

Modern Shopify apps use App Bridge to embed seamlessly inside the Shopify admin. This means your app loads in an iframe, giving merchants a native-feeling experience without leaving the dashboard.

Add the App Bridge script to your Blade layout:

<script src="https://unpkg.com/@shopify/app-bridge@2"></script>
<script>
var AppBridge = window['app-bridge'];
var createApp = AppBridge.default;
var app = createApp({
    apiKey: '{{ config('shopify-app.api_key') }}',
    shopOrigin: '{{ Auth::user()->name }}',
});
</script>

Handling Webhooks

Shopify sends webhook notifications to your app when important events happen — orders placed, products updated, apps uninstalled. Set up webhook routes in Laravel to process these events reliably.

// routes/web.php
Route::post('/webhooks/orders-create', [WebhookController::class, 'ordersCreate'])
    ->middleware('shopify.webhook');

Deploying with Codemason

Once your app is ready for production, deploying with Codemason is straightforward. Codemason handles Docker containerization, SSL certificates, and scaling automatically — so you can focus on your app, not your infrastructure.

$ mason create my-shopify-app
$ git push codemason master

That's it. Your Shopify app is live and ready for merchants to install. The combination of Laravel's expressiveness and Codemason's deployment simplicity means you can go from idea to production in a single afternoon.