docusign / docusign-esign-php-client

The Official Docusign PHP Client Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
https://www.docusign.com/devcenter
MIT License
198 stars 123 forks source link

Contribution/Building instructions #87

Closed 4c0n closed 2 years ago

4c0n commented 4 years ago

Hi,

I and perhaps others would like to contribute to this library. However there are no instructions with regards to building a new version of this package.

Could you please provide/document how to generate/build this package?

In the comments I saw that the classes have been generated using swagger-codegen. I have tried to generate the same classes as in this library using swagger-codegen-cli however the classes I get are quite different from the ones in this library (They depend on Guzzle instead of cURL and I suppose we need cURL instead of Guzzle for BC?).

Maybe it is related to the version of swagger-codegen?

Anyway something like https://help.github.com/en/articles/setting-guidelines-for-repository-contributors would be highly appreciated along with some information on how to build this package.

Also it would be interesting to know more about the timeline with regards to supporting older PHP versions. Currently the docs state that PHP 5.4 and higher is supported. Officially even PHP 7.1 is not even actively supported anymore: https://www.php.net/supported-versions.php So maybe at some point in the near future this package can drop support for PHP 5.x?

Thanks in advance for your time and effort.

4c0n commented 4 years ago

@larrykluger @LarryKlugerDS @MattKingDS @TonyMannDS @jwimberley-ds Would any of you happen to have an answer?

I did notice that when using an old version of swagger-codegen the classes that are generated look more like the ones in this repository. However there are some methods that are not generated, like for example the generateAccessToken() method. Were the classes generated and edited afterwards (although the comment block in pretty much every class states that the file should not be edited manually, bc they're generated)? Or am I missing something with regards to generating the client classes?

LarryKlugerDS commented 4 years ago

Hi @4c0n, Thank you for your questions.

Contributing to the DocuSign eSignature PHP SDK.

Yes, we'd like to enable you and other developers to contribute to the SDK's development.

We're currently using a private fork of the CodeGen tool to generate the SDK from the Swagger file. So today, contributions to most of the SDK can't be provided as pull requests. -- But we do value your comments about the SDK, please submit issues.

We have a plan to update to a public code generation system, please ask your DocuSign support or account representative to add your organization's name and information to ticket DCM-2367.

Unfortunately we don't yet have a schedule for this update.

OAuth Methods

The OAuth methods in the SDK are written by hand, they're not generated via the Swagger file. You're welcome to file issues and/or PRs for them.

PHP version support

I'm not an expert on PHP. Can you provide the top reasons why we should no longer support 7.1 or below? Are there new PHP patterns that we should use that are only supported on versions after 7.1?

Thank you for using DocuSign!

4c0n commented 4 years ago

Hi @LarryKlugerDS,

Thanks for your response! It's very useful. What I was missing mostly in the ApiClient is that yes there is a method generateAccessToken(), but unfortunately no refreshAccessToken() (In my fork I added it, so I'll send a PR for that later). I noticed that with OpenAPI version 3 it is possible to generate the authentication related code as well and it requires very little changes to the swagger file. I might send a PR for that one soon. It might help, because the the new version has support for defining all of the OAuth2 flows that are available (as far as I could tell).

As far as the PHP support goes: There were a lot of major changes in version 7, some of them are for example improved strict typing. So with version 7 we're finally capable of using return type declarations. Using type hints for parameters that are primitive types is another important one. For example in PHP5:

public function returnSomething($parameter)
{
    return $parameter;
}

In PHP7+:

public function returnSomething(string $parameter): string
{
    return $parameter;
}

The latter being a lot less error prone. The PHP5 version of that method will work fine in PHP7, the other way around not so much. However since most of the lib is generated it might not make that much of a difference right now. The new version of swagger-codegen generates a client based on the Guzzle 6 HTTP client which requires PHP 5.5 as a minimum version. Also since there are no patches at all being made for PHP version 5 it cannot be considered secure anymore, so motivating people to move on to PHP 7 could be a reason on by itself.