### Install the package with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/README.md Run this command to install the PayPal Server SDK version 2.2.0 and automatically add the dependency to your composer.json file. ```bash composer require "paypal/paypal-server-sdk:2.2.0" ``` -------------------------------- ### Get Setup Token Example Usage Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/vault.md Example usage of the getSetupToken method. The $id variable must be a string with minimum length 7, maximum length 36, and pattern ^[0-9a-zA-Z_-]+$. The method returns an ApiResponse instance; use getResult() to obtain the SetupTokenResponse data. ```php $id = 'id0'; $apiResponse = $vaultController->getSetupToken($id); ``` -------------------------------- ### Install Text_Template with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-text-template/README.md Adds phpunit/php-text-template as a project dependency using Composer. ```bash composer require phpunit/php-text-template ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phar-io/version/README.md Adds the library as a project dependency. Use the --dev flag for development-time dependencies. ```bash composer require phar-io/version ``` ```bash composer require --dev phar-io/version ``` -------------------------------- ### Create Setup Token - PHP example usage Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/vault.md Example usage of the createSetupToken method. Builds a SetupTokenRequest with a payment source and passes it in the $collect array. The response is an ApiResponse containing SetupTokenResponse data. ```php $collect = [ 'body' => SetupTokenRequestBuilder::init( SetupTokenRequestPaymentSourceBuilder::init()->build() )->build() ]; $apiResponse = $vaultController->createSetupToken($collect); ``` -------------------------------- ### Install dependencies with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/doctrine/instantiator/CONTRIBUTING.md Changes to the Instantiator directory, downloads the Composer installer, and runs a Composer update to install project dependencies. ```sh $ cd Instantiator $ curl -s https://getcomposer.org/installer | php $ php composer.phar update ``` -------------------------------- ### Install async-aws/ses via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/vendor/async-aws/ses/README.md Use Composer to install the AsyncAws SES client package. This is the required setup step before using the SES API client. ```cli composer require async-aws/ses ``` -------------------------------- ### Quickstart example: launch a child process and listen to output and exit Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/child-process/README.md Launches a child process with the 'echo foo' command, listens to its STDOUT data events, and handles the 'exit' event to display the exit code. Requires the ReactPHP event loop and stream components. ```php $process = new React\ChildProcess\Process('echo foo'); $process->start(); $process->stdout->on('data', function ($chunk) { echo $chunk; }); $process->on('exit', function($exitCode, $termSignal) { echo 'Process exited with code ' . $exitCode . PHP_EOL; }); ``` -------------------------------- ### Create and start a process with a simple command Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/child-process/README.md Pass any command line string to the Process constructor and start it. On Unix, PHP wraps the command in a shell (sh -c), so this example actually executes 'sh -c echo test'. ```php $process = new Process('echo test'); $process->start(); ``` -------------------------------- ### Install Text_Template as Dev Dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-text-template/README.md Adds phpunit/php-text-template as a development-time dependency, suitable for running test suites. ```bash composer require --dev phpunit/php-text-template ``` -------------------------------- ### Install Version as Development Dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/version/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/version ``` -------------------------------- ### Install dependencies: composer install Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/clue/ndjson-react/README.md Run this command after cloning the repository to install all dependencies needed for the test suite. ```bash composer install ``` -------------------------------- ### Install and run stripe-mock Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Fetch and run stripe-mock from a background terminal. The test suite depends on it. ```bash go install github.com/stripe/stripe-mock@latest stripe-mock ``` -------------------------------- ### Install dependencies with just or composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Install project dependencies using the just command or the equivalent composer install command. ```bash just install # or: composer install ``` -------------------------------- ### Run examples with Composer script Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/vendor/google/recaptcha/README.md Use the Composer script to serve examples locally via PHP dev server at http://localhost:8080/. ```sh composer run-script serve-examples ``` -------------------------------- ### Run the test suite Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Run the full test suite using just or the PHPUnit binary. Dependencies must be installed first. ```bash just test # or: ./vendor/bin/phpunit ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-file-iterator/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev phpunit/php-file-iterator ``` -------------------------------- ### PHP client setup and transaction creation with AvaTax Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/avalara/avataxclient/README.md Shows how to create an AvaTaxClient, authenticate, ping the server, and use TransactionBuilder to create simple and complex transactions. Requires the Composer autoloader and valid credentials. ```php withSecurity('myUsername', 'myPassword'); // If I am debugging, I can call 'Ping' to see if I am connected to the server $p = $client->ping(); echo('

Ping

'); echo('
' . json_encode($p, JSON_PRETTY_PRINT) . '
'); if ($p->authenticated == true) { echo '

Authenticated!

'; } // Create a simple transaction for $100 using the fluent transaction builder $tb = new Avalara\TransactionBuilder($client, "DEFAULT", Avalara\DocumentType::C_SALESINVOICE, 'ABC'); $t = $tb->withAddress('SingleLocation', '123 Main Street', null, null, 'Irvine', 'CA', '92615', 'US') ->withLine(100.0, 1, null, "P0000000") ->create(); echo('

Transaction #1

'); echo('
' . json_encode($t, JSON_PRETTY_PRINT) . '
'); // Now, let's create a more complex transaction! $tb = new Avalara\TransactionBuilder($client, "DEFAULT", Avalara\DocumentType::C_SALESINVOICE, 'ABC'); $t = $tb->withAddress('ShipFrom', '123 Main Street', null, null, 'Irvine', 'CA', '92615', 'US') ->withAddress('ShipTo', '100 Ravine Lane', null, null, 'Bainbridge Island', 'WA', '98110', 'US') ->withLine(100.0, 1, null, "P0000000") ->withLine(1234.56, 1, null, "P0000000") ->withExemptLine(50.0, null, "NT") ->withLine(2000.0, 1, null, "P0000000") ->withLineAddress(Avalara\TransactionAddressType::C_SHIPFROM, "123 Main Street", null, null, "Irvine", "CA", "92615", "US") ->withLineAddress(Avalara\TransactionAddressType::C_SHIPTO, "1500 Broadway", null, null, "New York", "NY", "10019", "US") ->withLine(50.0, 1, null, "FR010000") ->create(); echo('

Transaction #2

'); echo('
' . json_encode($t, JSON_PRETTY_PRINT) . '
'); ?> ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/environment/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/environment ``` -------------------------------- ### Web installation steps Source: https://github.com/abantecart/abantecart-src/blob/master/README.md Place the contents of /public_html in your web root and navigate to the installer in your browser. ```text Place contents of `/public_html` in your web root directory. Open your browser and navigate to: http://localhost/abantecart-src/public_html/ Follow the web installer instructions. ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/complexity/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/complexity ``` -------------------------------- ### Install Composer on Mac OS Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Install Composer using Homebrew on macOS, as a prerequisite for the Stripe PHP library development setup. ```bash brew install composer ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/global-state/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/global-state ``` -------------------------------- ### Composer require command Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Installs the apimatic/unirest-php package via Composer. ```shell composer require apimatic/unirest-php ``` -------------------------------- ### Install Symfony Mailer via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/vendor/symfony/mailer/README.md Use this command to install the Mailer component with Composer. Run it in your project root to add the dependency. ```bash composer require symfony/mailer ``` -------------------------------- ### Get Setup Token Method Signature Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/vault.md Returns a readable representation of temporarily vaulted payment source associated with the setup token id. ```php function getSetupToken(string $id): ApiResponse ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/comparator/README.md Adds the library as a local, per-project dependency using Composer. ```bash composer require sebastian/comparator ``` -------------------------------- ### Install via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/doctrine/instantiator/README.md Install the library using Composer with the command `composer require doctrine/instantiator`. ```sh composer require doctrine/instantiator ``` -------------------------------- ### Install apimatic/core via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/core/README.md Run this command to install the package and automatically add the dependency to your composer.json file. ```bash composer require "apimatic/core" ``` -------------------------------- ### Get Billing Plan - Example Usage Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/subscriptions.md Example call to getBillingPlan with an ID. The response is an ApiResponse whose getResult() returns a BillingPlan object. ```php $id = 'id0'; $apiResponse = $subscriptionsController->getBillingPlan($id); ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/recursion-context/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/recursion-context ``` -------------------------------- ### Install a public preview SDK version with composer require Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Use this command to install a Stripe PHP SDK version with a `-beta.X` suffix (e.g., `15.0.0-beta.1`). Replace `` with the exact version from the releases page. Pin the version in composer.json to avoid breaking changes between preview versions. ```bash composer require stripe/stripe-php:v ``` -------------------------------- ### Install as development-time dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/code-unit-reverse-lookup/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/code-unit-reverse-lookup ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/object-enumerator/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/object-enumerator ``` -------------------------------- ### Install Événement via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/evenement/evenement/README.md Install the Événement library using Composer with the command `composer require evenement/evenement`. ```bash $ composer require evenement/evenement ``` -------------------------------- ### Create a Stripe customer with StripeClient Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Instantiate StripeClient with a secret key and create a customer with description, email, and payment method. The example uses a test key 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' and payment method 'pm_card_visa'. Echoing the customer object outputs its representation. ```php $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $customer = $stripe->customers->create([ 'description' => 'example customer', 'email' => 'email@example.com', 'payment_method' => 'pm_card_visa', ]); echo $customer; ``` -------------------------------- ### Install dependencies and run tests Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/wikimedia/composer-merge-plugin/README.md Run these commands to install dependencies and execute the test suite. Requires Composer to be installed. ```bash $ composer install ``` ```bash $ composer test ``` -------------------------------- ### Install via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/README.md Install the UPS PHP SDK bindings via Composer. Run this command to install all supported APIs. ```bash composer require abantecart/ups-php ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/object-reflector/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/object-reflector ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/cli-parser/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/cli-parser ``` -------------------------------- ### After: Using Guzzle\Common\Collection::fromConfig Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/guzzlehttp/guzzle/UPGRADING.md Shows the updated code after the upgrade, using Collection::fromConfig instead of Inspector::fromConfig. This is the recommended replacement for the before example. ```php use Guzzle\Common\Collection; class YourClient extends \Guzzle\Service\Client { public static function factory($config = array()) { $default = array(); $required = array('base_url', 'username', 'api_key'); $config = Collection::fromConfig($config, $default, $required); $client = new self( $config->get('base_url'), $config->get('username'), $config->get('api_key') ); $client->setConfig($config); $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); return $client; } } ``` -------------------------------- ### Install as dev dependency with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/exporter/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/exporter ``` -------------------------------- ### Install as dev dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-timer/README.md Adds phpunit/php-timer as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev phpunit/php-timer ``` -------------------------------- ### Run HTTP server with systemd socket activation Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/socket/CHANGELOG.md Command to start the example HTTP server using systemd socket activation, passing the file descriptor URI. ```bash $ systemd-socket-activate -l 8000 php examples/03-http-server.php php://fd/3 ``` -------------------------------- ### Install via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/event-loop/README.md Install the latest supported version of the event loop library using Composer. ```bash composer require react/event-loop:^1.6 ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-invoker/README.md Adds phpunit/php-invoker as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev phpunit/php-invoker ``` -------------------------------- ### Output of basic timing example Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-timer/README.md Example output from the basic timing code, showing the Duration class name and formatted duration values. ```text string(32) "SebastianBergmann\Timer\Duration" string(9) "00:00.002" float(0.002851062) float(2.851062) float(2851.062) int(2851062) ``` -------------------------------- ### Configuration::init()->auth() Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Creates a Configuration instance with basic authentication credentials. The third parameter is a bitmask specifying the HTTP authentication method(s) to use. ```APIDOC ## Configuration::init()->auth() ### Description Creates a Configuration instance with basic authentication credentials. The third parameter is a bitmask specifying the HTTP authentication method(s) to use. ### Method Configuration::init()->auth() ### Parameters - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. - **authMethod** (int) - Optional - A bitmask of CURLAUTH_* constants specifying the authentication method(s). Default is CURLAUTH_BASIC. ### Request Example ```php $configuration = Configuration::init() ->auth('username', 'password', CURLAUTH_BASIC); ``` ### Response Returns a Configuration instance with the authentication settings applied. ``` -------------------------------- ### Install via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/child-process/README.md Installs the latest supported version of react/child-process (^0.6.7) via Composer. ```bash composer require react/child-process:^0.6.7 ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/myclabs/deep-copy/README.md Install the DeepCopy library using Composer. ```bash composer require myclabs/deep-copy ``` -------------------------------- ### Initialize the API client with PayPal Server SDK Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/README.md Use this PHP code to initialize the PayPal Server SDK client with OAuth client credentials, sandbox environment, and logging configuration. The client is built using the PaypalServerSdkClientBuilder. ```php use PaypalServerSdkLib\Logging\LoggingConfigurationBuilder; use PaypalServerSdkLib\Logging\RequestLoggingConfigurationBuilder; use PaypalServerSdkLib\Logging\ResponseLoggingConfigurationBuilder; use Psr\Log\LogLevel; use PaypalServerSdkLib\Environment; use PaypalServerSdkLib\Authentication\ClientCredentialsAuthCredentialsBuilder; use PaypalServerSdkLib\PaypalServerSdkClientBuilder; $client = PaypalServerSdkClientBuilder::init() ->clientCredentialsAuthCredentials( ClientCredentialsAuthCredentialsBuilder::init( 'OAuthClientId', 'OAuthClientSecret' ) ) ->environment(Environment::SANDBOX) ->loggingConfiguration( LoggingConfigurationBuilder::init() ->level(LogLevel::INFO) ->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true)) ->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true)) ) ->build(); ``` -------------------------------- ### Install Guzzle via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/guzzlehttp/guzzle/README.md Command to install Guzzle using Composer, the recommended installation method. ```bash composer require guzzlehttp/guzzle ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/fidry/cpu-core-counter/README.md Install the fidry/cpu-core-counter package via Composer. ```shell composer require fidry/cpu-core-counter ``` -------------------------------- ### Render a simple Mustache template with Mustache_Engine Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/vendor/mustache/mustache/README.md Quick example showing how to instantiate Mustache_Engine with 'entity_flags' set to ENT_QUOTES and render a template with a simple variable. Outputs 'Hello World!'. ```php ENT_QUOTES)); echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!" ``` -------------------------------- ### Install sebastian/code-unit as a development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/code-unit/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/code-unit ``` -------------------------------- ### Get Authorized Payment Example Usage Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/payments.md Example call to getAuthorizedPayment with an authorization ID. The response is stored in $apiResponse. ```php $collect = [ 'authorizationId' => 'authorization_id8' ]; $apiResponse = $paymentsController->getAuthorizedPayment($collect); ``` -------------------------------- ### Install Version with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/version/README.md Adds the library as a local, per-project dependency using Composer. ```bash composer require sebastian/version ``` -------------------------------- ### Get Order Example Usage Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/orders.md Example of calling getOrder with the required 'id' parameter. The response data is of type Order. ```php $collect = [ 'id' => 'id0' ]; $apiResponse = $ordersController->getOrder($collect); ``` -------------------------------- ### Run test suite: vendor/bin/phpunit Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/clue/ndjson-react/README.md Execute this command from the project root to run the test suite after dependencies are installed. ```bash vendor/bin/phpunit ``` -------------------------------- ### Run PHPUnit tests Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/doctrine/instantiator/CONTRIBUTING.md Executes the PHPUnit test suite using the version installed as a dev-dependency via Composer. The project requires 80% code coverage for new contributions. ```sh $ ./vendor/bin/phpunit ``` -------------------------------- ### Get Subscription Example Usage Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/subscriptions.md Example call to getSubscription with the required 'id' parameter. The $collect array is passed to the controller method. ```php $collect = [ 'id' => 'id0' ]; $apiResponse = $subscriptionsController->getSubscription($collect); ``` -------------------------------- ### Basic Guzzle HTTP client usage with synchronous and asynchronous requests Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/guzzlehttp/guzzle/README.md Shows how to create a Guzzle client, send a synchronous GET request, and inspect the response. Also demonstrates sending an asynchronous request with a promise and waiting for it to complete. The example uses the GuzzleHttp\Client and GuzzleHttp\Psr7\Request classes. ```php $client = new \GuzzleHttp\Client(); $response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle'); echo $response->getStatusCode(); // 200 echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8' echo $response->getBody(); // '{"id": 1420053, "name": "guzzle", ...}' // Send an asynchronous request. $request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org'); $promise = $client->sendAsync($request)->then(function ($response) { echo 'I completed! ' . $response->getBody(); }); $promise->wait(); ``` -------------------------------- ### Per-request API key and Stripe account configuration Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Set a per-request key and/or account for apps using Stripe Connect. The example shows passing 'api_key' and 'stripe_account' options to the all() and retrieve() methods. ```php $customers = $stripe->customers->all([],[ 'api_key' => 'sk_test_...', 'stripe_account' => 'acct_...']); $stripe->customers->retrieve('cus_123456789', [], [ 'api_key' => 'sk_test_...', 'stripe_account' => 'acct_...']); ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phar-io/manifest/README.md Adds the library as a local, per-project dependency. Use the --dev flag to install only for development, such as for running the test suite. ```bash composer require phar-io/manifest ``` ```bash composer require --dev phar-io/manifest ``` -------------------------------- ### Install via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/cache/README.md Install the latest supported version of react/cache using Composer. Requires Composer to be installed. ```bash composer require react/cache:^1.2 ``` -------------------------------- ### Get cURL info with getInfo utility method Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Alias for curl_getinfo to retrieve information about the last transfer. The example calls getInfo on the HTTP client. ```php // alias for `curl_getinfo` $httpClient->getInfo(); ``` -------------------------------- ### Get array of header values with getHeader Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/psr/http-message/docs/PSR7-Usage.md Retrieves header values as an array. Works for both request and response headers. The response example shows the array of values from the added header. ```php // getting value from request headers $request->getHeader('Content-Type'); // will return: ["text/html", "charset=UTF-8"] // getting value from response headers $response->getHeader('My-Custom-Header'); // will return: ["My Custom Message", "The second message"] ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-file-iterator/README.md Adds the library as a project dependency using Composer. ```bash composer require phpunit/php-file-iterator ``` -------------------------------- ### Install as development dependency with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/comparator/README.md Adds the library as a development-time dependency, for instance to run the project's test suite. ```bash composer require --dev sebastian/comparator ``` -------------------------------- ### Install PHP Parser with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/nikic/php-parser/README.md Install the library using Composer. Run this command in your project directory. ```bash php composer.phar require nikic/php-parser ``` -------------------------------- ### Get Payment Token - Example Usage Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/vault.md Example call to getPaymentToken with a sample ID. The method returns an ApiResponse instance; use getResult() to obtain the PaymentTokenResponse data. ```php $id = 'id0'; $apiResponse = $vaultController->getPaymentToken($id); ``` -------------------------------- ### Install Stripe PHP bindings with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Run this command in your project directory to install the Stripe PHP library via Composer. Requires PHP 5.6.0 or later. ```bash composer require stripe/stripe-php ``` -------------------------------- ### PHP usage example for Tokenizer and XMLSerializer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/theseer/tokenizer/README.md Parse PHP source code into tokens and serialize them to XML. The example reads a file, parses it, and outputs the XML. ```php $tokenizer = new TheSeer\Tokenizer\Tokenizer(); $tokens = $tokenizer->parse(file_get_contents(__DIR__ . '/src/XMLSerializer.php')); $serializer = new TheSeer\Tokenizer\XMLSerializer(); $xml = $serializer->toXML($tokens); echo $xml; ``` -------------------------------- ### Install composer/semver with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/composer/semver/README.md Install the latest version of the composer/semver library using Composer. Requires PHP 5.3.2 or later, but using the latest PHP version is recommended. ```bash composer require composer/semver ``` -------------------------------- ### Get comma-separated header values with getHeaderLine Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/psr/http-message/docs/PSR7-Usage.md Retrieves header values as a comma-separated string. Works for both request and response headers. The response example shows combined values from the added header. ```php // getting value from request headers $request->getHeaderLine('Content-Type'); // will return: "text/html; charset=UTF-8" // getting value from response headers $response->getHeaderLine('My-Custom-Header'); // will return: "My Custom Message; The second message" ``` -------------------------------- ### Convert HTTP message to string using Message::toString Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/guzzlehttp/psr7/README.md Use Message::toString() to get the string representation of an HTTP message. The example creates a GET request to http://example.com and echoes the result. ```php $request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); echo GuzzleHttp\Psr7\Message::toString($request); ``` -------------------------------- ### Switch to production environment Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_authorizenet/vendor/authorizenet/authorizenet/README.md By default the SDK uses the sandbox environment. Replace the environment constant in the execute method with ANetEnvironment::PRODUCTION to use production. Remember to use production credentials. ```php // For PRODUCTION use $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION); ``` -------------------------------- ### Install react/stream via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/stream/README.md Installs the latest supported version of react/stream (^1.4) using Composer. Follows SemVer. ```bash composer require react/stream:^1.4 ``` -------------------------------- ### Set default request headers in bulk with defaultHeaders Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Set multiple default headers at once by passing an array. The example sets Header1 and Header2 with their values. ```php $configuration = Configuration::init() ->defaultHeaders([ 'Header1' => 'Value1', 'Header2' => 'Value2' ]); ``` -------------------------------- ### Configuration::init()->proxyAuth() Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Sets proxy authentication credentials on the Configuration instance. The third parameter is a bitmask specifying the HTTP authentication method(s) to use for proxy authentication. ```APIDOC ## Configuration::init()->proxyAuth() ### Description Sets proxy authentication credentials on the Configuration instance. The third parameter is a bitmask specifying the HTTP authentication method(s) to use for proxy authentication. ### Method Configuration::init()->proxyAuth() ### Parameters - **username** (string) - Required - The username for proxy authentication. - **password** (string) - Required - The password for proxy authentication. - **authMethod** (int) - Optional - A bitmask of CURLAUTH_* constants specifying the authentication method(s). Default is CURLAUTH_BASIC. ### Request Example ```php $configuration = Configuration::init() ->proxyAuth('username', 'password', CURLAUTH_DIGEST); ``` ### Response Returns a Configuration instance with the proxy authentication settings applied. ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/complexity/README.md Adds the library as a local, per-project dependency using Composer. ```bash composer require sebastian/complexity ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/resource-operations/README.md Adds the library as a project dependency via Composer. ```bash composer require sebastian/resource-operations ``` -------------------------------- ### Create Order Example Usage Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/orders.md Example of calling createOrder with a body built using OrderRequestBuilder and PurchaseUnitRequestBuilder. Sets the prefer header to 'return=minimal'. ```php $collect = [ 'body' => OrderRequestBuilder::init( CheckoutPaymentIntent::CAPTURE, [ PurchaseUnitRequestBuilder::init( AmountWithBreakdownBuilder::init( 'currency_code6', 'value0' )->build() )->build() ] )->build(), 'prefer' => 'return=minimal' ]; $apiResponse = $ordersController->createOrder($collect); ``` -------------------------------- ### Install react/socket via Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/socket/README.md Use Composer to install the latest supported version of react/socket (^1.17). Requires Composer and follows SemVer. ```bash composer require react/socket:^1.17 ``` -------------------------------- ### Install for PHP >= 5.6 Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/ralouphie/getallheaders/README.md Use this Composer command to install the getallheaders polyfill for PHP versions 5.6 and above. ```bash composer require ralouphie/getallheaders ``` -------------------------------- ### Basic Usage of SebastianBergmann\Version Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/version/README.md Creates a Version instance with a release version and path, then calls getVersion() to retrieve the version string. The output shows a typical result from a Git repository. ```php getVersion()); ?> ``` ```text string(18) "3.7.10-17-g00f3408" ``` -------------------------------- ### Install the Package with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/core-interfaces/README.md Run this command to install the apimatic/core-interfaces package and automatically add the dependency to your composer.json file. ```php composer require "apimatic/core-interfaces" ``` -------------------------------- ### Basic Usage of CpuCoreCounter Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/fidry/cpu-core-counter/README.md Shows how to instantiate CpuCoreCounter, get the number of cores, handle exceptions, use a fallback finder, and note that results are memoized. ```php use Fidry\CpuCoreCounter\CpuCoreCounter; use Fidry\CpuCoreCounter\NumberOfCpuCoreNotFound; use Fidry\CpuCoreCounter\Finder\DummyCpuCoreFinder; $counter = new CpuCoreCounter(); // For knowing the number of cores you can use for launching parallel processes: $counter->getAvailableForParallelisation()->availableCpus; // Get the number of CPU cores (by default it will use the logical cores count): try { $counter->getCount(); // e.g. 8 } catch (NumberOfCpuCoreNotFound) { return 1; // Fallback value } // An alternative form where we not want to catch the exception: $counter = new CpuCoreCounter([ ...CpuCoreCounter::getDefaultFinders(), new DummyCpuCoreFinder(1), // Fallback value ]); // A type-safe alternative form: $counter->getCountWithFallback(1); // Note that the result is memoized. $counter->getCount(); // e.g. 8 ``` -------------------------------- ### Example AST dump output Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/nikic/php-parser/README.md Example output from dumping the AST of the parsed code. Shows the structure of the AST for a function with a var_dump call. ```text array( 0: Stmt_Function( attrGroups: array( ) byRef: false name: Identifier( name: test ) params: array( 0: Param( attrGroups: array( ) flags: 0 type: null byRef: false variadic: false var: Expr_Variable( name: foo ) default: null ) ) returnType: null stmts: array( 0: Stmt_Expression( expr: Expr_FuncCall( name: Name( name: var_dump ) args: array( 0: Arg( name: null value: Expr_Variable( name: foo ) byRef: false unpack: false ) ) ) ) ) ) ) ``` -------------------------------- ### Install for PHP < 5.6 Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/ralouphie/getallheaders/README.md Use this Composer command to install version 2 of the getallheaders polyfill for PHP versions below 5.6. ```bash composer require ralouphie/getallheaders "^2" ``` -------------------------------- ### SebastianBergmann\Version::__construct Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/version/README.md Creates a new Version instance. The constructor expects a release version string and a path to the project source code. ```APIDOC ## Constructor: SebastianBergmann\Version::__construct ### Description Creates a new Version instance. The constructor expects a release version string and a path to the project source code. ### Method Constructor ### Signature `public function __construct(string $release, string $path)` ### Parameters - **$release** (string) - Required - The version number of the latest release (`X.Y.Z`, for instance) or the name of the release series (`X.Y`) when no release has been made from that branch / for that release series yet. - **$path** (string) - Required - The path to the directory (or a subdirectory thereof) where the sourcecode of the project can be found. Simply passing `__DIR__` here usually suffices. ### Example ```php $version = new SebastianBergmann\Version( '3.7.10', '/usr/local/src/phpunit' ); ``` ``` -------------------------------- ### Unhandled rejection example Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/promise/CHANGELOG.md Demonstrates the default behavior of reporting unhandled rejections. The output shows the rejection message with the file and line number. ```php // Unhandled promise rejection with RuntimeException: Unhandled in example.php:2 reject(new RuntimeException('Unhandled')); ``` -------------------------------- ### Install as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/resource-operations/README.md Adds the library as a development-time dependency, useful for running test suites. ```bash composer require --dev sebastian/resource-operations ``` -------------------------------- ### Set proxy authentication with proxyAuth (basic auth) Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Configure proxy authentication with a username and password, defaulting to Basic Authentication. The example uses 'username' and 'password'. ```php // basic auth $configuration = Configuration::init() ->proxyAuth('username', 'password'); ``` -------------------------------- ### Get Split Tender ID Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_authorizenet/vendor/authorizenet/authorizenet/doc/AIM.markdown Retrieves the split tender id from the response after a partial auth. ```PHP $split_tender_id = $response->split_tender_id; ``` -------------------------------- ### Output of resource usage with explicit duration Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-timer/README.md Example output showing time and memory usage. ```text Time: 00:00.002, Memory: 6.00 MB ``` -------------------------------- ### After: Using Guzzle\Common\Collection::fromConfig Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/guzzlehttp/guzzle/UPGRADING.md Shows the updated client factory using Collection::fromConfig after the migration. ```php use Guzzle\Common\Collection; class YourClient extends \Guzzle\Service\Client { public static function factory($config = array()) { $default = array(); $required = array('base_url', 'username', 'api_key'); $config = Collection::fromConfig($config, $default, $required); $client = new self( $config->get('base_url'), $config->get('username'), $config->get('api_key') ); $client->setConfig($config); $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); return $client; } ``` -------------------------------- ### Install sebastian/diff as development dependency Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/diff/README.md Adds the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev sebastian/diff ``` -------------------------------- ### Creating DeepCopy instance Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/myclabs/deep-copy/README.md Shows how to create a custom DeepCopy instance with the constructor parameter set to true. ```php use DeepCopy\DeepCopy; $copier = new DeepCopy(true); $copy = $copier->copy($var); ``` -------------------------------- ### Install as development dependency with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/phpunit/php-code-coverage/README.md Adds phpunit/php-code-coverage as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev phpunit/php-code-coverage ``` -------------------------------- ### Set default cURL options in bulk with curlOpts Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Set multiple default cURL options at once by passing an array. The example sets CURLOPT_COOKIE to 'foo=bar'. ```php $configuration = Configuration::init() ->curlOpts(array( CURLOPT_COOKIE => 'foo=bar' )); ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/environment/README.md Adds the library as a local, per-project dependency using Composer. ```bash composer require sebastian/environment ``` -------------------------------- ### Set default request headers with defaultHeader Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Set default headers that will be sent on every request. The example sets two headers: Header1 with Value1 and Header2 with Value2. ```php $configuration = Configuration::init() ->defaultHeader('Header1', 'Value1') ->defaultHeader('Header2', 'Value2'); ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/global-state/README.md Adds the library as a local, per-project dependency using Composer. ```bash composer require sebastian/global-state ``` -------------------------------- ### Get Vault Controller Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/doc/controllers/vault.md Retrieves the VaultController instance from the client to manage payment and setup tokens. ```php $vaultController = $client->getVaultController(); ``` -------------------------------- ### AuthorizeNetAIM::setECheck() Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/default_authorizenet/vendor/authorizenet/authorizenet/doc/AIM.markdown Sets the required fields for an electronic check transaction. This method simplifies the setup of eCheck transactions. ```APIDOC ## [POST] AuthorizeNetAIM::setECheck() ### Description Sets the required fields for an electronic check transaction. This method simplifies the setup of eCheck transactions. ### Method POST ### Endpoint AuthorizeNetAIM::setECheck() ### Parameters #### Request Body - **bank_aba_code** (string) - Required - Bank routing number - **bank_acct_num** (string) - Required - Bank account number - **bank_acct_type** (string) - Required - Bank account type (e.g., CHECKING) - **bank_name** (string) - Required - Name of the bank - **bank_acct_name** (string) - Required - Name on the bank account - **echeck_type** (string) - Required - Type of eCheck (e.g., WEB) ### Request Example ```php $sale = new AuthorizeNetAIM; $sale->amount = "45.00"; $sale->setECheck( '121042882', // bank_aba_code '123456789123', // bank_acct_num 'CHECKING', // bank_acct_type 'Bank of Earth', // bank_name 'Jane Doe', // bank_acct_name 'WEB' // echeck_type ); $response = $sale->authorizeAndCapture(); ``` ### Response #### Success Response (200) - **response** (object) - AuthorizeNetAIM response object with transaction results #### Response Example ```php $response = $sale->authorizeAndCapture(); ``` ``` -------------------------------- ### Composer require --dev theseer/tokenizer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/theseer/tokenizer/README.md Install the library as a development-time dependency, for example to run the project's test suite. ```bash composer require --dev theseer/tokenizer ``` -------------------------------- ### Composer require for AvaTax PHP SDK Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/avalara/avataxclient/README.md Add the avalara/avataxclient package to your project's composer.json to install the SDK via Composer. ```json { "require": { "avalara/avataxclient": "*" } } ``` -------------------------------- ### Get skipped Xdebug version with XdebugHandler::getSkippedVersion() Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/composer/xdebug-handler/README.md Returns the Xdebug version string that was skipped by the restart, or an empty string if there was no restart or Xdebug is still loaded. Example output: '3.1.1'. ```php use Composer\XdebugHandler\XdebugHandler; $version = XdebugHandler::getSkippedVersion(); # $version: '3.1.1' (for example), or an empty string ``` -------------------------------- ### Simple clone example Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/myclabs/deep-copy/README.md Shows basic PHP object cloning using the clone keyword. ```php $myCopy = clone $myObject; ``` -------------------------------- ### Access response data with getLastResponse() Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Retrieve headers from the last API response on any object using getLastResponse(). The example shows accessing the Request-Id header after creating a customer. ```php $customer = $stripe->customers->create([ 'description' => 'example customer', ]); echo $customer->getLastResponse()->headers['Request-Id']; ``` -------------------------------- ### Set proxy with proxy method (quick setup, custom port, tunneling) Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Configure a proxy for requests. The first example uses default port 1080, the second sets a custom port and proxy type (CURLPROXY_HTTP), and the third enables tunneling. Proxy types include CURLPROXY_HTTP, CURLPROXY_HTTP_1_0, CURLPROXY_SOCKS4, CURLPROXY_SOCKS5, CURLPROXY_SOCKS4A, and CURLPROXY_SOCKS5_HOSTNAME. ```php // quick setup with default port: 1080 $configuration = Configuration::init() ->proxy('10.10.10.1'); ``` ```php // custom port and proxy type $configuration = Configuration::init() ->proxy('10.10.10.1', 8080, CURLPROXY_HTTP); ``` ```php // enable tunneling $configuration = Configuration::init() ->proxy('10.10.10.1', 8080, CURLPROXY_HTTP, true); ``` -------------------------------- ### Run an individual test file Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/stripe/vendor/stripe/stripe-php/README.md Run a specific test file using just or PHPUnit, e.g., tests/Stripe/UtilTest.php. ```bash just test tests/Stripe/UtilTest.php # or: ./vendor/bin/phpunit tests/Stripe/UtilTest.php ``` -------------------------------- ### Prepend to body by seeking and writing Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/psr/http-message/docs/PSR7-Usage.md Shows how writing to a stream after seeking to the start overwrites existing content, resulting in 'efcd' instead of 'efabcd'. The stream must be seeked to the beginning before writing to prepend. ```php // assuming our response is initially empty $body = $repsonse->getBody(); // writing the string "abcd" $body->write('abcd'); // seeking to start of stream $body->seek(0); // writing 'ef' $body->write('ef'); // at this point the stream contains "efcd" ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/code-unit-reverse-lookup/README.md Adds the library as a local, per-project dependency using Composer. ```bash composer require sebastian/code-unit-reverse-lookup ``` -------------------------------- ### Add the package to composer.json manually Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/paypal/paypal-server-sdk/README.md Add this JSON block to your composer.json file under the "require" section to manually specify the PayPal Server SDK version 2.2.0. ```json "require": { "paypal/paypal-server-sdk": "2.2.0" } ``` -------------------------------- ### Inject custom CurlMulti object via ServiceBuilder event Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/guzzlehttp/guzzle/UPGRADING.md Used to reuse a single CurlMulti object across clients by listening to the 'service_builder.create_client' event. Note the extra closing brace in the original example. ```php $multi = new Guzzle\Http\Curl\CurlMulti(); $builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json'); $builder->addListener('service_builder.create_client', function ($event) use ($multi) { $event['client']->setCurlMulti($multi); } }); ``` -------------------------------- ### Create HttpClient with default configurations Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/paypal_commerce/vendor/apimatic/unirest-php/README.md Instantiates a new Unirest\HttpClient with default settings, typically as a class-level property. ```php private $httpClient = new \Unirest\HttpClient(); ``` -------------------------------- ### Client request methods: 3.0 vs 4.0 Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/guzzlehttp/guzzle/UPGRADING.md In Guzzle 4.0, calling methods like get() now sends the request and returns the response directly. To mirror the old behavior, use createRequest() and send(). ```php // 3.0 $request = $client->get('/'); $response = $request->send(); // 4.0 $response = $client->get('/'); // or, to mirror the previous behavior $request = $client->createRequest('GET', '/'); $response = $client->send($request); ``` -------------------------------- ### Run a simple command with wrapping shell Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/react/child-process/README.md Even simple commands are wrapped in a shell on Unix. This example shows that 'yes' actually spawns a command hierarchy: php -> sh -c yes -> yes. The wrapping shell receives the process PID and signals. ```php $process = new Process('yes'); $process->start(); ``` -------------------------------- ### Native function calls with leading slash Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/avatax_integration/vendor/guzzlehttp/guzzle/UPGRADING.md In Guzzle 7.0, all internal native function calls are prefixed with a slash to prevent method overloading by other libraries or applications. The example shows the change from `curl_version()` to `\curl_version()`. ```php // Before: curl_version(); // After: \curl_version(); ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/recursion-context/README.md Adds the library as a local, per-project dependency using Composer. ```bash composer require sebastian/recursion-context ``` -------------------------------- ### Install with Composer Source: https://github.com/abantecart/abantecart-src/blob/master/public_html/extensions/ups/core/ups_sdk/vendor/sebastian/exporter/README.md Adds the library as a project dependency using Composer. ```bash composer require sebastian/exporter ```