phpclassic / php-shopify

PHP SDK for Shopify API
Apache License 2.0
568 stars 211 forks source link

Can create two instances of Shopify SDK #226

Open vicn1222 opened 3 years ago

vicn1222 commented 3 years ago

Static is used in ShopifySDK.php. It is not reentry. Can't create two instances of ShopifySDK.

Can developers please remove static?

Thanks.

bavamca commented 3 years ago

i thought yes , you can use two instance but you need to specify name space sperate for each instances

marxolly commented 3 years ago

I use a parent class and have a function in it

protected function resetConfig($config) { return PHPShopify\ShopifySDK::config($config); }

Then I have extending classes that have their own private config array

In each of these extending classes, I call the function resetConfig so the Shopify object has the correct configuration before I call any of the PHPShopify functions

Using this method, I have set up 4 different instances of the Shopify object for use with different clients and shops inside my web application

Hope this might help