phpclassic / php-shopify

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

ShopifySDK not recognized #139

Open DamjanRI opened 4 years ago

DamjanRI commented 4 years ago

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);

tareqtms commented 4 years ago

@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).

DamjanRI commented 4 years ago

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);

tareqtms commented 4 years ago

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

DamjanRI commented 4 years ago

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*

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

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