Authors: crissanclick , Interactiv4
A Shopify Symfony PHP skeleton to make your life easier and start your new APP faster.
This project skeleton is using Domain Driven Design (DDD) and Hexagonal Architecture (Ports & Adapters) to make it easier to understand and maintain.
It also uses the shopify/shopify-api package to make the Shopify API calls and it is based on the official Shopify PHP template replacing Laravel framework for a clean Symfony project.
Shopify apps are built on a variety of Shopify tools to create a great merchant experience.
The Symfony PHP app template comes with the following out-of-the-box functionality:
This project combines a number of third party open source tools:
i18next
and related libraries are used to internationalize the frontend.
react-i18next
is used for React-specific i18n functionality.i18next-resources-to-backend
is used to dynamically load app translations.@formatjs/intl-localematcher
is used to match the user locale with supported app locales.@formatjs/intl-locale
is used as a polyfill for Intl.Locale
if necessary.@formatjs/intl-pluralrules
is used as a polyfill for Intl.PluralRules
if necessary.These third party tools are complemented by Shopify specific tools to ease app development:
@shopify/i18next-shopify
is a plugin for i18next
that allows translation files to follow the same JSON schema used by Shopify app extensions and themes.yarn install
app
folder and run composer install
to install all backend the dependencies.etc/databases/skeleton-app.sql
and import it in your MySQL serverapps/app/frontend
folder and run yarn install or npm install
to install all frontend the dependencies.cp .env.example .env
and fill the .env
file with your Shopify APP credentials and decide if you want to charge something to use the APP, defining the interval and the required data.yarn dev or npm run dev
to start the development server. (It will automatically raise the backend server and will map a real cloudflare domain against your localhost using the 8030 port)Install app
inside the Shopify panel to update your .env file with the API_KEY_CLIENT and API_KEY_SECRET.There are some things missing (Cover all APIs, Uninstall APP, improve documentation...), feel free to add this if you want! If you want some guidelines feel free to contact me :)
.env
fileAPP_BILLING_REQUIRED=true
APP_BILLING_CHARGE_NAME="My app name"
APP_BILLING_AMOUNT=9.99
APP_BILLING_CURRENCY=EUR
APP_BILLING_INTERVAL=month or anual
APP_BILLING_TYPE=EVERY_30_DAYS or ONE_TIME
Crissanclick\App\Auth\Infrastructure\Shopify\Webhook\Handler\Uninstall
)Crissanclick\App\Auth\Infrastructure\Shopify\Webhook\Uninstall
)Provide the webhook information in the Webhook class like:
class Uninstall implements Webhook
{
public function __construct(private readonly UninstallHandler $handler)
{
}
public function type(): string
{
return 'APP_UNINSTALLED';
}
public function handler(): WebhookHandler
{
return $this->handler;
}
}
+info: https://shopify.dev/docs/admin-api/rest/reference/events/webhook