php-shopify icon indicating copy to clipboard operation
php-shopify copied to clipboard

ShopifySDK not recognized

Open DamjanRI opened this issue 5 years ago • 5 comments

I have install php-shopify with composer but it seems that autoload.php does not load files properly?

require_once('PHPShopify/autoload.php'); $config = array( 'ShopUrl' => $shop . ".myshopify.com", 'ApiKey' => $api_key, 'Password' => $shared_secret, );

$shopify = new ShopifySDK($config);

DamjanRI avatar Feb 15 '20 20:02 DamjanRI

@DamjanRI Is the path for autoload.php correct? I think it should be something like PHPShopify/vendor/autoload.php (if PHPShopify is the folder where composer.json is present).

tareqtms avatar Feb 16 '20 09:02 tareqtms

I have composer.json in PHPShopify folder and autoload in PHPShopify/vendor folder but still its not recognized! In main php file I have require_once('PHPShopify/vendor/autoload.php'), is this ok, is namespace or use required? object is created like this $config = array( 'ShopUrl' => $shop . ".myshopify.com", 'ApiKey' => $api_key, 'Password' => $shared_secret, );

$shopify = new ShopifySDK($config);

and it crashes on object creation $shopify = new ShopifySDK($config);

DamjanRI avatar Feb 16 '20 10:02 DamjanRI

Where is your main file located? Is it inside "PHPShopify" folder?

tareqtms avatar Feb 16 '20 10:02 tareqtms

No I have app folder where main.php is located then PHPShopify folder inside it like library

App\main.php App\PHPShopify \composer.json App\PHPShopify \vendor\autoload.php App\PHPShopify \vendor\phpclassic\php-shopify
App\PHPShopify \vendor\phpclassic\php-shopify\lib*

DamjanRI avatar Feb 16 '20 10:02 DamjanRI

require_once('PHPShopify/vendor/autoload.php');
$config = array(
'ShopUrl' => $shop . ".myshopify.com",
'ApiKey' => $api_key,
'Password' => $shared_secret,
);

$shopify = new PHPShopify\ShopifySDK($config);

tareqtms avatar Feb 17 '20 06:02 tareqtms