<?php /** * Downloads PayPal PHP SDK dependencies based on your composer.json file */ define('DS', DIRECTORY_SEPARATOR); define('COMPOSER_FILE', 'composer.json'); // name of the bootstrap file in custom installation define('BOOTSTRAP_FILE', 'PPBootStrap.php'); // URL from where the composer.json is downloaded if not present define('COMPOSER_URL', 'https://raw.github.com/paypal/merchant-sdk-php/stable/samples/composer.json'); // Flag to control whether composer should be used for installation $useComposer = false; init($useComposer); createAutoload(); createBootStrap(BOOTSTRAP_FILE); echo "Installation successful"; exit(0); function init($useComposer) { // download if composer.json is not present if (!file_exists(COMPOSER_FILE)) { $fp = fopen(COMPOSER_FILE, "w"); curlExec(COMPOSER_URL, $fp); fclose($fp); } // check if composer is installed if ($useComposer) { @exec('composer', $output, $status); if ($status == 0) { @exec('composer update', $output, $status);
define('COMPOSER_FILE', 'composer.json'); $useComposer = false; // name of the bootstrap file in custom installation $bootStrap = 'PPBootStrap.php'; // Required : URL from where the composer.json is downloaded if not present $composerUrl = 'https://raw.github.com/paypal/merchant-sdk-php/composer/samples/composer.json'; /** * initiates and installs the SDK */ init($useComposer, $composerUrl); /** * Autoloads all the classes */ createAutoload(); if (!file_exists($bootStrap)) { createBootStrap($bootStrap); } echo "installation successful"; function init($useComposer, $composerUrl) { // download if composer.json is not present if (!file_exists(COMPOSER_FILE)) { $fp = fopen(COMPOSER_FILE, "w"); curlExec($composerUrl, $fp); fclose($fp); } /** * check if composer is installed */ if ($useComposer) { @exec('composer', $output, $status);