PHP code example of woganmay / domo-php

1. Go to this page and download the library: Download woganmay/domo-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/ */

    

woganmay / domo-php example snippets


use WoganMay\DomoPHP\Client;

// Create a new instance by passing in the client ID and Secret yourself
$client = new Client("your-client-id", "your-client-secret");

// Or, if you can set environment variables (DOMO_CLIENT_ID and DOMO_CLIENT_SECRET), the Client
// can read those, letting you simply do this:
$client = new Client();

// That's the recommended approach when using a framework (like Laravel) that reads .env variables into
// your environment! You can now call API methods via the $client object, for eg:
$allUsers = $client->user()->getList();

// Every API has a helper proxy method, as follows:
$client->account(); // Account API
$client->activityLog(); // Activity Log API
$client->dataSet(); // DataSet API
$client->embedToken(); // Embed Token API
$client->group(); // Group API
$client->page(); // Page API
$client->projects(); // Projects and Tasks API
$client->simple(); // Simple API
$client->stream(); // Stream API
$client->user(); // User API

use WoganMay\DomoPHP\Client;

$client = new Client();

// The domo-php library expects key-value pairs, where the keys are the column headers, and the values
// are the data type. Valid types are: STRING, DECIMAL, LONG, DOUBLE, DATE, DATETIME
$schema = [
    'id' => 'LONG',
    'name' => 'STRING',
    'created_at' => 'DATETIME'
];

// This will create a new, empty dataset with our schema
$dataset = $client->dataSet()->create("My new dataset", $schema);

// We'll build a simple set of CSV data, though in real life you'd be reading this directly from a file,
// using file_get_contents() or similar. Domo expects \n line endings, and for the first line of the provided
// data to