magicalella/yii2-shopify

Shopify component for Yii 2 framework

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2025-06-17 11:06 UTC

This package is auto-updated.

Last update: 2025-06-17 11:06:39 UTC


README

Modulo per integrare la Yii con Shopify

Shopify Technical API Documentation Generate access Token (https://shopify.dev/docs/apps/build/authentication-authorization/access-tokens/generate-app-access-tokens-admin)

Installation

The preferred way to install this extension is through composer.

Run

composer require "magicalella/yii2-shopify" "*"

or add

"magicalella/yii2-shopify": "*"

to the require section of your composer.json file.

Configuration

Component Setup

  1. Add component to your config file
'components' => [
    // ...
    'shopify' => [
        'class' => 'magicalella\shopify\Shopify',
        'storeName' => 'store name in Shopify',
        'accessToken' => 'accessToken generate in Shopify APP',
        'apiVersion' => 'api version settin durinf build APP in Shopify',
    ],
]

Usage:

Query:

const QUERY_CHECK = <<<QUERY
query test (\$userId: Int!){
  userInfo (userId: \$userId) {
    firstname
    lastname
    email
  }
}
QUERY;

$result = Yii::$app->graphql->execute(QUERY_CHECK, ['userId' => (int) $userId], 'github');

ActiveDataProvider:

use magicalella\shopify\ShopifyDataProvider;

// If you want to use pagination in ActiveDataProvider, Set $offset and $limit in your query. Everything will be handled automatically.
const QUERY = <<<QUERY
query(\$limit: Int, \$offset: Int){
  categories (first: \$limit, skip: \$offset){
    id
    name
    icon
  }
}
QUERY;

$dataProvider = new ShopifyDataProvider([
    'query' => QUERY,
    'queryCallback' => 'data.categories', // How to access the array in responded query result? More: https://www.yiiframework.com/doc/guide/2.0/en/helper-array#getting-values
    'totalCountQuery' => 'query { categoriesConnection { aggregate { count } } }',
    'target' => 'prisma',
]);

return $this->render('index', [
    'dataProvider' => $dataProvider,
]);