docusign-esign-php-client: Fatal error: Class 'DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions' not found

Dear Devs,

Composer can’t load the subject class. Please generate separate php files per namespaces/classes in under proper directory path.

<?php
require 'vendor/autoload.php';

$options = new DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions();
// results: Fatal error: Uncaught Error: Class 'DocuSign\eSign\Api\EnvelopesApi\ListStatusChangesOptions' not found in ...

The class in the file src/Api/EnvelopesApi.php instead of src/Api/EnvelopesApi/ListStatusChangesOptions.php regarding to its namespace. Relating docs to your psr-4 composer setting: http://www.php-fig.org/psr/psr-4

Best regards, Karoly

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

The issue still persists.

A workaround can be used if you edit your composer.json as shown beelow. You can add a “classmap” entry to generate an additional autoload mapping.

    "autoload": {
        "psr-4": {
            "App\\": "src/"
        },
        "classmap": [
            "vendor/docusign/esign-client/src"
        ]
    },

@harsharahul, could we please have your input on this issue?

@adrienfr – Thank you for your comment. I’ve re-opened the issue and notified the product manager. He’ll work with our engineering group on the issue.

Just to note, this has just caused us problems while trying to get our new DocuSign-based solution up and running. We used the composer workaround given by @alxvgt and that works alright (thanks @alxvgt !) but it’s a pretty poor developer experience when something as basic as this doesn’t function properly. PSR-4 has been the standard for PHP autoloading for many years now and PHP devs tend to assume it’ll “just work”…

If it can’t be fixed (which would be a shame), could it be mentioned somewhere in DocuSign’s main developer documentation to make it more obvious and stop future developers from wasting their time?

(EDIT: I see it is actually mentioned here: https://developers.docusign.com/docs/esign-rest-api/sdks/php/setup-and-configuration/ … but, it’s under the “Downloading the SDK from the GitHub repository” heading which is likely to be ignored by a lot of developers as they’ll have just followed the composer instructions in the previous section).

@LarryKlugerDS is it possible to re-open this issue or should we create another one?

The issue is still here, psr-4 autoload is not respected in DocuSign\eSign\Api\TemplatesApi.php and DocuSign\eSign\Api\EnvelopesApi.php, there should be only one file for each class.

The main problem is the generated php source is not PSR-4 compatible: http://www.php-fig.org/psr/psr-4

The subdirectory name MUST match the case of the sub-namespace names.

But neither EnvelopesApi directory exists, nor ListStatusChangesOptions is a separate file.

If I split EnvelopesApi.php file to separate classes in EnvelopesApi directory, everything is fine.