msdev2/shopify
Composer 安装命令:
composer require msdev2/shopify
包简介
setup basic shopify app like install and all
关键字:
README 文档
README
setup basic shopify app like install and all
composer require msdev2/shopify
php artisan vendor:publish --provider="Msdev2\Shopify\ShopifyServiceProvider"
only public file
php artisan vendor:publish --provider="Msdev2\Shopify\ShopifyServiceProvider" --tag="public" --force
- update menu items
- update plan
- update billing
Add to config/app
'providers' => [
/*
* Package Service Providers...
*/
Msdev2\Shopify\ShopifyServiceProvider::class,
]
To install shop
[domain]/install -- for ui
<a htef="{{ route('msdev2.install') }}">Install</a> -- for link of ui
https://[domain]/authenticate?shop=[shopify_domain] -- instent redirect
Update shopify app callback url
[shop]/auth/callback
Update ENV variables
SHOPIFY_API_KEY=63f2fa001d************
SHOPIFY_API_SECRET=47f72686a3************
SHOPIFY_APP_ID=548698745823
SHOPIFY_API_SCOPES=read_products,write_products
SHOPIFY_BILLING=true #false
SHOPIFY_FOOTER=<div>copyright @copy; all right reserved</div>
SHOPIFY_IS_EMBEDDED_APP=true #false //true if you want to open an app inside shopify else false
SHOPIFY_APPBRIDGE_ENABLED=true #true
SHOPIFY_ENABLE_ALPINEJS=true #true if you want to use vue make it false
SHOPIFY_ENABLE_TURBOLINKS=true #true if you want to use vue make it false
SHOPIFY_TEST_STORES=mraganksoni,msdev203
TAWK_URL=https://https://embed.tawk.to/64cbaca1cc26a871b02d0bcf/1h6tpkmh2
SHOPIFY_API_VERSION=2023-04
Setup hooks
update env
SHOPIFY_WEBHOOKS=APP_UNINSTALLED,THEMES_PUBLISH,SHOP_UPDATE
create hook receiver file
app/Webhook/Handlers/AppUninstalled.php
app/Webhook/Handlers/ShopUpdate.php
app/Webhook/Handlers/ThemesPublish.php
middleware lists
msdev2.shopify.verify //to verify shop exist in url
msdev2.shopify.auth //to authenticate shopify user
msdev2.shopify.installed //to check if shopify is installed
setup layout for blade
css reference is https://www.uptowncss.com/
@extends('msdev2::layout.master')
@section('content')
<div class="mt-20">
//your code here
</div>
@endsection
@section('scripts')
@parent
<script type="text/javascript">
actions.TitleBar.create(app, { title: 'Welcome' });
</script>
@endsection
helper functions
route helper functions
\Msdev2\Shopify\Utils::Route('home',['app'=>'home']) or mRoute('home',['app'=>'home])
\Msdev2\Shopify\Utils::Route('home') or mRoute('home')
\Msdev2\Shopify\Utils::Route('home.name') or mRoute('home.name')
\Msdev2\Shopify\Utils::Route('/pagename') or mRoute('/pagename')
other common helper functions
\Msdev2\Shopify\Utils::$shop;
\Msdev2\Shopify\Utils::getShop(?$shopname) or mShop(?$shopname)
\Msdev2\Shopify\Utils::getShopName() or mShopName()
\Msdev2\Shopify\Utils::rest(?$shop) or mRest(?$shop)
\Msdev2\Shopify\Utils::graph(?$shop) or mGraph(?$shop)
\Msdev2\Shopify\Utils::makeUrltoLinkFromString($string) or mUrltoLinkFromString($string)
\Msdev2\Shopify\Utils::successResponse(?$message,?$array,?$code) or mSuccessResponse(?$message,?$array,?$code)
\Msdev2\Shopify\Utils::errorResponse(?$message,?$array,?$code) or mErrorResponse(?$message,?$array,?$code)
mLog($message, ?$array, ?$logLevel, ?$channel)
for vuejs route helper
window.$GLOBALS.push(path)
window.$GLOBALS.push(path, params)
window.$GLOBALS.push(name)
window.$GLOBALS.push(name, params)
window.$GLOBALS.shop
window.$GLOBALS.host
window.$GLOBALS.csrfToken
window.$GLOBALS.processRequest(url, data, isImageRequest) # url = 'POST /url' data = {} isImageRequest=false
window.$GLOBALS.showToast(msg,isError,subscribeFun,clearFun) # msg = string isError=false subscribeFun=callback function clearFun=callback function
showToast(msg,isError,subscribeFun,clearFun) # msg = string isError=false subscribeFun=callback function clearFun=callback function
save tabel to metafield
class ModelName extend \Msdev2\Shopify\Models\Model
{
/** set true to save this data into metafield*/
public $metaField = true;
}
use shopify logs
$shop->log('message',[],'type','channel')
$shop->log('log added successfully',['test'=>'info'],'alert','shopify')
load without ssl
\vendor\shopify\shopify-api\src\Clients\HttpClientFactory.php
return new Client(['verify' => false]);
msdev2/shopify 适用场景与选型建议
msdev2/shopify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 138 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 08 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sdk」 「driver」 「shopify」 「laravel」 「facade」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 msdev2/shopify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 msdev2/shopify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 msdev2/shopify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Galera cluster driver for Doctrine
A PHP client driver for the RethinkDB query language (ReQL)
A PSR-7 compatible library for making CRUD API endpoints
Arikam CMS Driver package
Use a REST API as if it was your local database
A PHP client driver for the RethinkDB query language (ReQL)
统计信息
- 总下载量: 138
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-05