JeremyDunn / php-fedex-api-wrapper

This library provides a fluid interface for constructing requests to the FedEx web service API.
269 stars 184 forks source link

Uncaught Error: Class "SoapClient" not found #198

Closed s22-tech closed 2 years ago

s22-tech commented 2 years ago

Using track-by-id.php in the example folder as a basis, I'm getting this error:

PHP Fatal error:  Uncaught Error: Class "SoapClient" not found in /php/JeremyDunn/vendor/jeremy-dunn/php-fedex-api-wrapper/src/FedEx/AbstractRequest.php:50
Stack trace:
#0 /php/JeremyDunn/fedex.php(53): FedEx\AbstractRequest->__construct()
#1 {main}
  thrown in /php/JeremyDunn/vendor/jeremy-dunn/php-fedex-api-wrapper/src/FedEx/AbstractRequest.php on line 50

Is there something else that needs to be installed for this wrapper to work?

Thanks,

cookieguru commented 2 years ago

You need the PHP SOAP extension. If you installed this with Composer you should have gotten a warning, unless you used --ignore-platform-reqs. You can find installation instructions here

conrad10781 commented 2 years ago

I just ran into the same issue when installing via composer. I did not supplied ignore-platform-reqs, and the package installed without warning despite the extension not being enabled yet.


composer require jeremy-dunn/php-fedex-api-wrapper

Using version ^3.0 for jeremy-dunn/php-fedex-api-wrapper
./composer.json has been created

Running composer update jeremy-dunn/php-fedex-api-wrapper
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking jeremy-dunn/php-fedex-api-wrapper (3.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading jeremy-dunn/php-fedex-api-wrapper (3.0)
  - Installing jeremy-dunn/php-fedex-api-wrapper (3.0): Extracting archive
Generating autoload files

Additionally, according to the package.json anyway , the SOAP extension is not being required ( IE no ext-soap or similar in the require ):

{
            "name": "jeremy-dunn/php-fedex-api-wrapper",
            "version": "3.0",
            "source": {
                "type": "git",
                "url": "https://github.com/JeremyDunn/php-fedex-api-wrapper.git",
                "reference": "6b7465013b7f8313801d635a0bf864b0afcb5007"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/JeremyDunn/php-fedex-api-wrapper/zipball/6b7465013b7f8313801d635a0bf864b0afcb5007",
                "reference": "6b7465013b7f8313801d635a0bf864b0afcb5007",
                "shasum": ""
            },
            "require": {
                "php": ">=5.4.0"
            },
            "require-dev": {
                "apigen/apigen": "^4.1",
                "fzaninotto/faker": "^1.6",
                "phpunit/phpunit": "^5.7",
                "squizlabs/php_codesniffer": "*",
                "symfony/console": "2.*"
            },
            "type": "library",
            "autoload": {
                "psr-4": {
                    "FedEx\\": "src/FedEx/",
                    "FedEx\\Tests\\": "tests/FedEx/Tests",
                    "FedEx\\Utility\\": "util/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Jeremy Dunn",
                    "email": "jeremy@jsdunn.info",
                    "homepage": "http://www.jsdunn.info"
                }
            ],
            "description": "API Wrapper for Fedex web services",
            "homepage": "https://github.com/JeremyDunn/php-fedex-api-wrapper",
            "keywords": [
                "FedEx",
                "shipping",
                "soap"
            ],
            "support": {
                "issues": "https://github.com/JeremyDunn/php-fedex-api-wrapper/issues",
                "source": "https://github.com/JeremyDunn/php-fedex-api-wrapper/tree/master"
            },
            "time": "2018-12-27T15:44:58+00:00"
        },

Enabling SOAP extension ultimately solved the problem. Just noting that the message did not appear as expected during the install

cookieguru commented 2 years ago

@conrad10781 You must have an outdated set of dependencies in your project because you've installed a version that's over 3 years old. This repo definitely has ext-soap listed in the required section:

https://github.com/JeremyDunn/php-fedex-api-wrapper/blob/main/composer.json#L16