From the DocuSign Developer Center under the Quick Start section there is the API Tools page. The first two tools listed are the API Explorer and the API Walkthroughs. Both are great tools that you should familiarize yourself with.
In the API Walkthroughs you'll see there are 9 of the most common API scenarios listed, each with sample code in 6 different languages including PHP
. The bottom three API Walkthroughs focused on Embedding functionality, which is what the LoanCo sample you've referenced uses. With Embedding, instead of sending an email notification to start signing your app or website can generate a URL token for signing, then you just navigate your user there in your app for them to sign.
Try copying the code for the Embedded Signing walkthrough and using that in your project. NOTE: That sample sends a request from a Template in your account. If you do not want to use a template but want to use a local document instead then look at the Request Signature on Document walkthrough and use that to create your envelope.
As for populating the data fields, in the JSON of your request body for creating the envelope you just need to provide values for the tabs, using their tabLabel
to indicate which tab (ie name) and the value
property to assign an actual value. Take a look at this SO post for more info on that:
Docusign: Dynamically Populate Fields In Document