cancel
Showing results for 
Search instead for 
Did you mean: 

SDK Audoloader

Hi, looking for a NON-Composer installation method, I came across some instructions on Github, with the heading of "Customer SPL Autoloader" (https://github.com/AuthorizeNet/sdk-php#custom-spl-autoloader) that is supposed to describe how to install without access to Composer. Except... Here's what they have to say (in part) in that section:

 

"You can run composer locally or on another system to build the directory, then copy the vendor directory to the desired system"

 

That doesn't really explain how to install without the help of Composer. Can't those instructions be a little more useful to those that don't have Composer, and are looking for an alternative? I mean, couldn't the author of that section simply list the dependency tree? Or, better yet, offer a link to a Github repository that contains said dependency tree? Clearly, if they are suggesting that you simple install Composer on a different machine (locally, for example), then the dependency tree must not be terribly machine specific.

 

 

jima
Regular Contributor
10 REPLIES 10

The dependency tree is a little bit machine specific in that the versions installed will vary depending on what version of PHP you have, and the versions of other dependencies. It's assumed that if you go the route of building the "vendor" directory on another machine, you'll at least be doing it with the same version of PHP that exists on the machine you intend to move to.

 

To resolve the version constraints for each dependency and each of those dependencies' dependencies (and so on) can certainly be done manually if you'd like. I'll post the dependency tree here shortly.

 

As to why we don't document all the required dependencies or make our own repo:

  • Good documentation takes time.
  • If the documentation wasn't good enough, we'd be fielding more support issues from those who've inadvertantly gotten themselves in a dependency pickle, taking more time.
  • Making our own repo would at minimum require our legal department to review each dependency to determine whether we have rights to distribute it ourselves. We could maybe link to things as sub-modules in GitHub to get around that, but that's still time.
  • If we did spend enough time to get the documentation perfect, or to have a legal review on our own repo, or to reconstruct the repo with a bunch of submodules, that's time wasted since we have a current effort to remove external dependencies from the PHP SDK.

Our goal is for the next version to not have any external dependencies. We'd still recommend installation via composer for the ease of building the autoload and things like that. But, it would be much easier at that point to say "Here's how you install without composer".

Aaron
All Star

Here's the dependency tree (as of today). Remember, this could change even if our code doesn't depending on whether a child package modifies its dependency requirements.

 

goetas-webservices/xsd2php-runtime v0.2.7 Convert XSD  (XML Schema) definitions into PHP classes
|--jms/serializer ^1.2
|  |--doctrine/annotations ^1.0
|  |  |--doctrine/lexer 1.*
|  |  |  `--php >=5.3.2
|  |  `--php ^5.6 || ^7.0
|  |--doctrine/instantiator ^1.0.3
|  |  `--php >=5.3,<8.0-DEV
|  |--jms/metadata ~1.1
|  |  `--php >=5.3.0
|  |--jms/parser-lib 1.*
|  |  `--phpoption/phpoption >=0.9,<2.0-dev
|  |     `--php >=5.3.0
|  |--php >=5.5.0
|  |--phpcollection/phpcollection ~0.1
|  |  `--phpoption/phpoption 1.*
|  |     `--php >=5.3.0
|  `--phpoption/phpoption ^1.1
|     `--php >=5.3.0
|--php >=5.5
`--symfony/yaml ^2.2|^3.0
   `--php >=5.5.9
phpunit/phpunit 4.8.36 The PHP Unit Testing framework.
|--ext-dom *
|--ext-json *
|--ext-pcre *
|--ext-reflection *
|--ext-spl *
|--php >=5.3.3
|--phpspec/prophecy ^1.3.1
|  |--doctrine/instantiator ^1.0.2
|  |  `--php >=5.3,<8.0-DEV
|  |--php ^5.3|^7.0
|  |--phpdocumentor/reflection-docblock ^2.0|^3.0.2
|  |  |--php >=5.5
|  |  |--phpdocumentor/reflection-common ^1.0@dev
|  |  |  `--php >=5.5
|  |  |--phpdocumentor/type-resolver ^0.3.0
|  |  |  |--php ^5.5 || ^7.0
|  |  |  `--phpdocumentor/reflection-common ^1.0
|  |  |     `--php >=5.5
|  |  `--webmozart/assert ^1.0
|  |     `--php ^5.3.3 || ^7.0
|  |--sebastian/comparator ^1.1|^2.0
|  |  |--php >=5.3.3
|  |  |--sebastian/diff ~1.2
|  |  |  `--php ^5.3.3 || ^7.0
|  |  `--sebastian/exporter ~1.2 || ~2.0
|  |     |--php >=5.3.3
|  |     `--sebastian/recursion-context ~1.0
|  |        `--php >=5.3.3
|  `--sebastian/recursion-context ^1.0|^2.0|^3.0
|     `--php >=5.3.3
|--phpunit/php-code-coverage ~2.1
|  |--php >=5.3.3
|  |--phpunit/php-file-iterator ~1.3
|  |  `--php >=5.3.3
|  |--phpunit/php-text-template ~1.2
|  |  `--php >=5.3.3
|  |--phpunit/php-token-stream ~1.3
|  |  |--ext-tokenizer *
|  |  `--php >=5.3.3
|  |--sebastian/environment ^1.3.2
|  |  `--php ^5.3.3 || ^7.0
|  `--sebastian/version ~1.0
|--phpunit/php-file-iterator ~1.4
|  `--php >=5.3.3
|--phpunit/php-text-template ~1.2
|  `--php >=5.3.3
|--phpunit/php-timer ^1.0.6
|  `--php ^5.3.3 || ^7.0
|--phpunit/phpunit-mock-objects ~2.3
|  |--doctrine/instantiator ^1.0.2
|  |  `--php >=5.3,<8.0-DEV
|  |--php >=5.3.3
|  |--phpunit/php-text-template ~1.2
|  |  `--php >=5.3.3
|  `--sebastian/exporter ~1.2
|     |--php >=5.3.3
|     `--sebastian/recursion-context ~1.0
|        `--php >=5.3.3
|--sebastian/comparator ~1.2.2
|  |--php >=5.3.3
|  |--sebastian/diff ~1.2
|  |  `--php ^5.3.3 || ^7.0
|  `--sebastian/exporter ~1.2 || ~2.0
|     |--php >=5.3.3
|     `--sebastian/recursion-context ~1.0
|        `--php >=5.3.3
|--sebastian/diff ~1.2
|  `--php ^5.3.3 || ^7.0
|--sebastian/environment ~1.3
|  `--php ^5.3.3 || ^7.0
|--sebastian/exporter ~1.2
|  |--php >=5.3.3
|  `--sebastian/recursion-context ~1.0
|     `--php >=5.3.3
|--sebastian/global-state ~1.0
|  `--php >=5.3.3
|--sebastian/version ~1.0
`--symfony/yaml ~2.1|~3.0
   `--php >=5.5.9
phpmd/phpmd 2.6.0 PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.
|--ext-xml *
|--pdepend/pdepend ^2.5
|  |--php >=5.3.7
|  |--symfony/config ^2.3.0|^3
|  |  |--php >=5.5.9
|  |  `--symfony/filesystem ~2.8|~3.0
|  |     `--php >=5.5.9
|  |--symfony/dependency-injection ^2.3.0|^3
|  |  |--php >=5.5.9
|  |  `--psr/container ^1.0
|  |     `--php >=5.3.0
|  `--symfony/filesystem ^2.3.0|^3
|     `--php >=5.5.9
`--php >=5.3.9

 

And here's the actual package versions installed by composer on a machine with PHP 5.6.30:

 

doctrine/annotations               v1.4.0 Docblock Annotations Parser
doctrine/instantiator              1.0.5  A small, lightweight utility to instantiate objects in PHP without invoking their co...
doctrine/lexer                     v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
goetas-webservices/xsd2php-runtime v0.2.7 Convert XSD  (XML Schema) definitions into PHP classes
jms/metadata                       1.6.0  Class/method/property metadata management in PHP
jms/parser-lib                     1.0.0  A library for easily creating recursive-descent parsers.
jms/serializer                     1.8.1  Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
pdepend/pdepend                    2.5.0  Official version of pdepend to be handled with Composer
phpcollection/phpcollection        0.5.0  General-Purpose Collection Library for PHP
phpdocumentor/reflection-common    1.0    Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock  3.2.2  With this component, a library can provide support for annotations via DocBlocks or ...
phpdocumentor/type-resolver        0.3.0 
phpmd/phpmd                        2.6.0  PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the wel...
phpoption/phpoption                1.5.0  Option Type for PHP
phpspec/prophecy                   v1.7.0 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage          2.2.4  Library that provides collection, processing, and rendering functionality for PHP co...
phpunit/php-file-iterator          1.4.2  FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template          1.2.1  Simple template engine.
phpunit/php-timer                  1.0.9  Utility class for timing
phpunit/php-token-stream           1.4.11 Wrapper around PHP's tokenizer extension.
phpunit/phpunit                    4.8.36 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects       2.3.8  Mock Object library for PHPUnit
psr/container                      1.0.0  Common Container Interface (PHP FIG PSR-11)
sebastian/comparator               1.2.4  Provides the functionality to compare PHP values for equality
sebastian/diff                     1.4.3  Diff implementation
sebastian/environment              1.3.8  Provides functionality to handle HHVM/PHP environments
sebastian/exporter                 1.2.2  Provides the functionality to export PHP variables for visualization
sebastian/global-state             1.1.1  Snapshotting of global state
sebastian/recursion-context        1.0.5  Provides functionality to recursively process PHP variables
sebastian/version                  1.0.6  Library that helps with managing the version number of Git-hosted PHP projects
symfony/config                     v3.3.6 Symfony Config Component
symfony/dependency-injection       v3.3.6 Symfony DependencyInjection Component
symfony/filesystem                 v3.3.6 Symfony Filesystem Component
symfony/yaml                       v3.3.6 Symfony Yaml Component
webmozart/assert                   1.2.0  Assertions to validate method input/output with nice error messages.

Wow, that's quite the list of dependencies. Do you know if those are, in fact, all needed? I see a ton of things in there that really don't seem like they should really be necessary, at least from my perspective.

For example, I'm really not understanding why phpunit and phpmd are necessary, or phpdocumentor for that matter. Those are all typically things that are only needed on development and/or test machines.

 

If I'm looking at deploying this to a couple hundred machines (with varying OSes and PHP versions) without the crutch of Composer, how would you suggest that I proceed?

jima
Regular Contributor

It's not at all necessary to use the SDK. It's trivial to call the API with your JSON or XML and work with the reponse any way you would like. 

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

Ok, I'm listening. Elaborate?

jima
Regular Contributor

A very simple example in PHP is below, replace any variables with your own ...

<?php

$xmlContent = '<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
  <merchantAuthentication>
    <name>YOUR_LOGIN_ID</name>
    <transactionKey>YOUR_TRANSACTION_KEY</transactionKey>
  </merchantAuthentication>
  <refId>123456</refId>
  <transactionRequest>
    <transactionType>authCaptureTransaction</transactionType>
    <amount>5</amount>
    <payment>
      <creditCard>
        <cardNumber>5424000000000015</cardNumber>
        <expirationDate>1220</expirationDate>
        <cardCode>999</cardCode>
      </creditCard>
    </payment>
    <order>
     <invoiceNumber>INV-12345</invoiceNumber>
     <description>Product Description</description>
    </order>
       <poNumber>456654</poNumber>
    <customer>
      <id>99999456654</id>
    </customer>
    <billTo>
      <firstName>Mary</firstName>
      <lastName>Jones</lastName>
      <address>120 Sunrise Way</address>
      <city>Palm Springs</city>
      <state>CA</state>
      <zip>92241</zip>
      <country>USA</country>
    </billTo>
      <transactionSettings>
         </transactionSettings>
     </transactionRequest>
</createTransactionRequest>';

  $url = 'https://apitest.authorize.net/xml/v1/request.api';
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlContent);
  $result = curl_exec($ch);
  echo $result;
  curl_close($ch);

Parse the resulting XML, done. 

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

That big list is not strictly needed. That's the list including dependencies listed as "require-dev" in composer, which are theoreticall only needed for developing the SDK itself.

 

The list without those SDK dev components actually looks like this:

 

goetas-webservices/xsd2php-runtime v0.2.7 Convert XSD  (XML Schema) definitions into PHP classes
|--jms/serializer ^1.2
|  |--doctrine/annotations ^1.0
|  |  |--doctrine/lexer 1.*
|  |  |  `--php >=5.3.2
|  |  `--php ^5.6 || ^7.0
|  |--doctrine/instantiator ^1.0.3
|  |  `--php >=5.3,<8.0-DEV
|  |--jms/metadata ~1.1
|  |  `--php >=5.3.0
|  |--jms/parser-lib 1.*
|  |  `--phpoption/phpoption >=0.9,<2.0-dev
|  |     `--php >=5.3.0
|  |--php >=5.5.0
|  |--phpcollection/phpcollection ~0.1
|  |  `--phpoption/phpoption 1.*
|  |     `--php >=5.3.0
|  `--phpoption/phpoption ^1.1
|     `--php >=5.3.0
|--php >=5.5
`--symfony/yaml ^2.2|^3.0
   `--php >=5.5.9

and on my PHP 5.6.30 installation, here's the versions installed:

 

doctrine/annotations               v1.4.0 Docblock Annotations Parser
doctrine/instantiator              1.0.5  A small, lightweight utility to instantiate objects in PHP without invoking their co...
doctrine/lexer                     v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
goetas-webservices/xsd2php-runtime v0.2.7 Convert XSD  (XML Schema) definitions into PHP classes
jms/metadata                       1.6.0  Class/method/property metadata management in PHP
jms/parser-lib                     1.0.0  A library for easily creating recursive-descent parsers.
jms/serializer                     1.8.1  Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
phpcollection/phpcollection        0.5.0  General-Purpose Collection Library for PHP
phpoption/phpoption                1.5.0  Option Type for PHP
symfony/yaml                       v3.3.6 Symfony Yaml Component

Still heavy, but maybe that's more workable. If that's not good enough, the suggestion by @NexusSoftware to hit the API directly is a good one as well.

Composer is not available to me; I specialize in very small business sites hosted in economy shared plans.

 

Therefore, I want to use the SPL autoloader. However, I am 100% confused by one thing.

 

What is the vendor folder?

 

 

Will

Shiandow's SuperRes is not what is typically being called SuperRes; it's something else. It does not "create" any details like traditional SuperRes or Sharpening algorithms do. It doesn't have any temporal effect either, it works with frames one by one. Here's the way it works.

Albright
Member