This tutorial will get you get up and running quickly with the Intacct SDK for PHP.

If you haven’t already done some preliminary reading, consider looking at the About the SDK before continuing.

Prerequisites

Set up

  1. Download or clone the Intacct PHP examples.

  2. Create a new PHP project for the examples in your IDE of choice.

  3. Add a composer.json file to your project and specify the Intacct SDK for PHP as a dependency:

    {
        "require": {
            "intacct/intacct-sdk-php": "v1.*"
        }
    }
    
  4. In a terminal window, run composer install in the directory containing your composer.json file.

    This creates a vendor folder and adds the Intacct SDK for PHP libraries and dependencies.

    Note: When you want to update your SDK installation with a newer version, run composer update.

  5. Open GettingStarted.php in your project and note the following line of code:

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

    This includes the Composer autoloader in the project file. Add this line to any PHP files you add to your project.

  6. Open the login.cfg template in your project and provide your login credentials.

Run the GettingStarted example

  1. Look at the GettingStarted.php code to learn about the API. Note how the IntacctClient instance establishes a session with your company and returns a result with the number of vendor objects.

  2. Run the program and observe the results.

    You get a listing of the number of vendor objects in your company. Also shown is a GUID that was autogenerated for the function’s control ID.

    Read function control ID: 55a09a8d-cdd0-4911-a753-dd9fe28146a4
    Number of vendor objects: 100
       
    Process finished with exit code 0
    

    Notes: If this is the first PHP program you’ve attempted to run in your IDE, you will be asked to specify the PHP interpreter to use. Also, if you get an exception from GuzzelHttp about a missing local SSL certificate, you likely need to add the path to a CA root certificate bundle to your php.ini file. For example: curl.cainfo="cacerts/curl-ca-bundle.crt"

What’s next?

Provide feedback