PHP Fatal error: Class 'Symfony\Component\Yaml\Yaml' not found
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.
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?
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"
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 what do you mean by " composer require symfony/yaml"?
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
Thanks. It works
Fixed in the latest release. Thanks
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
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
@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 -
{
"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/.
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.
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.
this has been solved in https://github.com/goetas-webservices/xsd2php-runtime with https://github.com/goetas-webservices/xsd2php-runtime/commit/94a406c8ff8f353d0f97e3ee5613b5c9dfa1a878
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.
Closing since this issue is fixed, as latest composer.json dependency from goetas/xsd2php-runtime to goetas-webservices/xsd2php-runtime .
Man why didn't the creators just add a php demo file :(