bseddon / xml-signer

Provides signing and verification of XML documents including support for XAdES
BSD 3-Clause "New" or "Revised" License
18 stars 7 forks source link

Class 'lyquidity\xmldsig\xml\SignatureProductionPlaceV2' not found #3

Closed sangar82 closed 2 years ago

sangar82 commented 2 years ago

Helllo!

After install the package with composer, I tried to sign an xml with the example provided in the user guide.

I obtain this error: Class 'lyquidity\xmldsig\xml\SignatureProductionPlaceV2' not found

Perhaps something wrong with the namespace or something similar to #1 ? . I can't know what is happening. The namespace and the filename seem ok.

There are severals classes with the same problem (SignerRoleV2 too) but InputResourceInfo is loading well.

I'm using the code with the last commit on main branch.

Thanks!

adriamt commented 2 years ago

Same for example for the class AttributeNames

bseddon commented 2 years ago

I've just downloaded the latest version and setup a test script which includes the example from the readme and it works OK for me. Because so many classes are failing maybe the issue is something else. For example, did you add 'use' statements for the classes referenced by the example? Without these PHP will not be able to locate the class. This is an omission by me so I have updated the example to show the necessary use statements which are:

use lyquidity\xmldsig\CertificateResourceInfo;
use lyquidity\xmldsig\InputResourceInfo;
use lyquidity\xmldsig\KeyResourceInfo;
use lyquidity\xmldsig\ResourceInfo;
use lyquidity\xmldsig\XAdES;
use lyquidity\xmldsig\xml\SignatureProductionPlaceV2;
use lyquidity\xmldsig\xml\SignerRoleV2;
use lyquidity\xmldsig\XMLSecurityDSig;

If you have downloaded the source from GitHub (rather than installing using composer) then you will also need to add a reference to the xml-signer autoloader.php or PHP will be unable to find the classes even if the 'use' statements exist. When xml-signer is installed using composer this step is not needed as its autoload.php is called when the composer autoload.php is referenced.

If you have downloaded the source from GitHub you will also need to separately download the dependent requester project. You will then need to reference the autoload.php from this project. Without these steps, PHP will be unable to find the certificate handling code.

download and the

sangar82 commented 2 years ago

thanks for your reply @bseddon !

and sorry for the omitted information:

I think is something about your autoload functions, something about differences Windows-linux system, as a route, a path, or something else. The file name and namespace seems to be correct for psr-4.

bseddon commented 2 years ago

Wow, you're right. It seems I did not push the change to the autoloader. The change suggested in #1 has been pushed and a new new release is available for composer. Thanks for letting me know.

sangar82 commented 2 years ago

It works! Thank you!