Search the Community
Showing results for tags 'moduels'.
-
I'm developing a module to integrate BigCommerce's Stores API (https://developer.bigcommerce.com/api) with PW. After a steep learning curve, I managed to use composer.json to download the latest version of the API into a 'vendor' directory. { "name": "processwire/processwire", "type": "library", "description": "ProcessWire CMS/CMF", "keywords": [ "cms","cmf", "content management system" ], "homepage": "https://processwire.com", "authors": [ { "name": "Ryan Cramer", "email": "ryan@processwire.com", "homepage": "https://processwire.com", "role": "Developer" } ], "require": { "php": ">=5.3.8", "ext-gd": "*", "bigcommerce/api": "*" }, "autoload": { "files": [ "wire/core/ProcessWire.php" ] }, "minimum-stability": "dev" } Using composer.json and its autoload.php feature works great. All I need in my template is: <?php use Bigcommerce\Api\Client as Bigcommerce; Bigcommerce::configure(array( 'store_url' => 'https://www.mybigcommerceshop.com', 'username' => 'admin@mybigcommerceshop.com', 'api_key' => '8fab84ce1776dbba18665xxxxxxxxxxxxf' )); $ping = Bigcommerce::getTime(); if ($ping) echo $ping->format('H:i:s'); My dilemma is that the files are in './vendor', not './site/modules'. Not everyone will use composer.json so looking for recommendations on how to best code the module to first look in './vendor', then if nothing there, look into './site/modules/BigCommerceApi/Api' to load the files (which may be out of date) and instantiate the API. Suggestions? Using: PW v3.0.24