sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

PHP Fatal error: Class 'Symfony\Component\Yaml\Yaml' not found

Open sunshinephotocart opened this issue 10 years ago • 17 comments

I get the error "PHP Fatal error: Class 'Symfony\Component\Yaml\Yaml' not found" when trying to use this. I am incredibly new to composer and loading files. I am still very much used to simply downloading a zip file and using the files - but that refused to work with this SDK so I tried composer and can't get that to work either.

sunshinephotocart avatar Jun 24 '16 05:06 sunshinephotocart

Thank you for raising this issue. Can you please provide more details on what you are trying to run. Is it a. Simply download sdk-php, run composer update, or b. Simply download sample-code-php, run composer update, run a sample code e.g. php PaymentTransactions/charge-credit-card.php, or c. Download sdk-php, run composer update. Use the generated vendor/autoload.php for your application?

ashtru avatar Jun 24 '16 06:06 ashtru

When I tried to download, it was none of the above. To me you should be able to simply download the set of files, include the necessary files and be done. I just don't understand the need to use composer whatsoever. I guess I don't really understand what it does.

Anyway, I was able to install composer in my directory, put the composer.json file in there, run the command line to get all the files, included the autoload.php in my script, ran a test charge and I got the error: "PHP Fatal error: Class 'Symfony\Component\Yaml\Yaml' not found"

sunshinephotocart avatar Jun 24 '16 14:06 sunshinephotocart

Same issue here .. looks like a deep dependency was not resolved.

To resolve this until the dependencies are fixed, just type:

composer require symfony/yaml

flyandi avatar Jun 26 '16 23:06 flyandi

@flyandi what do you mean by " composer require symfony/yaml"?

felixshi1989 avatar Jun 27 '16 19:06 felixshi1989

If you use this package outside of symfony, you need to install the symfony's yaml parser via composer.

That's the command line you need to execute or add symfony/yaml to required of your composer file.

I added the missing reference to my fork - pull request at: https://github.com/AuthorizeNet/sdk-php/pull/156

flyandi avatar Jun 27 '16 20:06 flyandi

Thanks. It works

felixshi1989 avatar Jun 27 '16 23:06 felixshi1989

Fixed in the latest release. Thanks

brianmc avatar Aug 13 '16 07:08 brianmc

While this issue is marked as closed, I encountered the same problem with JMS referencing YAML.

I installed the Authorize.net SDK-PHP using the command prompt of Composer yesterday, so I'm assuming that if the issue was solved in the latest release (per the August 13th comment), this problem should not have resurfaced.

This is the message recorded in the error_log file:

PHP Fatal error: Class 'yaml\Symfony\Component\Yaml\Yaml' not found in /home/_______/public_html/vendor/jms/serializer/src/JMS/Serializer/Metadata/Driver/YamlDriver.php on line 35

HealingRooms avatar Dec 07 '16 18:12 HealingRooms

Just installed today, same error...

php /path/to/composer.phar require symfony/yaml

Seems to be a hard-coded hack...

YAML is supposed to be optional but apparently is not...

DEBIAN

jms/serializer suggests installing symfony/yaml (Required if you'd like to serialize data to YAML format.)
Writing lock file
Generating autoload files

MonteShaffer avatar Dec 08 '16 14:12 MonteShaffer

@healingRooms,what is the version of PHP - SDK you are using?

@HealingRooms @monteshaffer What is the version of PHP you are using?

@monteshaffer, did running , composer.phar require symfony/yaml , fix the error?

ashtru avatar Dec 09 '16 20:12 ashtru

@ashtru -

{ "require": { "php": ">=5.5", "ext-curl": "*", "authorizenet/authorizenet": "1.9.2", "symfony/yaml": "^3.2" } }

I somehow got this to work, but it was after using FTP to delete the respective folders inside the /vendor/ folder, and then reinstalling authorizenet (and then the authorizenet samples) with composer from the parent folder of /vendor/.

HealingRooms avatar Dec 09 '16 21:12 HealingRooms

I am running ... PHP Version 5.6.27-0+deb8u1

and YES, running

php /path/to/composer.phar require symfony/yaml

fixed all my issues.

MonteShaffer avatar Dec 09 '16 23:12 MonteShaffer

I just refreshed my local clone (git pull upstream master) and updated (composer update); symfony\yaml was installed as expected where it wasn't before.

texdc avatar Dec 11 '16 21:12 texdc

this has been solved in https://github.com/goetas-webservices/xsd2php-runtime with https://github.com/goetas-webservices/xsd2php-runtime/commit/94a406c8ff8f353d0f97e3ee5613b5c9dfa1a878

goetas avatar Dec 15 '16 16:12 goetas

Installing the Yaml definitely helps, what might be the catch is that you need to delete you vendor libraries and reinstall them. Simply install the Yaml component is not enough. Don't ask me why but I face this issue often.

galvani avatar Mar 30 '17 20:03 galvani

Closing since this issue is fixed, as latest composer.json dependency from goetas/xsd2php-runtime to goetas-webservices/xsd2php-runtime .

ashtru avatar Jul 04 '18 06:07 ashtru

Man why didn't the creators just add a php demo file :(

AntonFarrell avatar Dec 05 '18 13:12 AntonFarrell