Exemplo n.º 1
0
<?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);
<?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/adaptivepayments-sdk-php/stable/samples/composer.json');
// Flag to control whether composer should be used for installation
$useComposer = false;
init($useComposer);
createAutoload($useComposer);
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);