PHP code example of sminnee / stitchdata-php

1. Go to this page and download the library: Download sminnee/stitchdata-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sminnee / stitchdata-php example snippets


use Sminnee\StitchData\StitchApi;
$api = new StitchApi(getenv('STITCHDATA_CLIENT_ID'), getenv('STITCHDATA_ACCESS_TOKEN'));

// Throws an exception if there's an issue with our connection
$api->validate();

// Push 2 records to the StitchData, upserting in your data warehouse, and creating the test_peopel table if needed
$api->pushRecords(
    'test_people', 
    [' id' ],
    [
        [
            "id" => 1,
            "first_name" => "Sam",
            "last_name" => "Minnee",
            "num_visits" => 3,
            "date_last_visit" => new Datetime("2018-06-26"),
        ],
        [
            "id" => 2,
            "first_name" => "Ingo",
            "last_name" => "Schommer",
            "num_visits" => 6,
            "date_last_visit" => new Datetime("2018-06-27"),
        ]
   ]
);


composer