PHP code example of reedtechus / azure-data-explorer-laravel

1. Go to this page and download the library: Download reedtechus/azure-data-explorer-laravel 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/ */

    

reedtechus / azure-data-explorer-laravel example snippets


return [
	/*
    |--------------------------------------------------------------------------
    | Azure Data Explorer
    |--------------------------------------------------------------------------
    |
    | This is the configuration for the Azure Data Explorer package.
    |
    */

    // The base URL of the Azure Data Explorer API.
    'base_url' => env('AZURE_DATA_EXPLORER_BASE_URL', 'https://login.microsoftonline.com'),

    // The tenant ID of the Azure Data Explorer API.
    'tenant_id' => env('AZURE_DATA_EXPLORER_TENANT_ID'),

    // The client ID of the Azure Data Explorer API.
    'client_id' => env('AZURE_DATA_EXPLORER_CLIENT_ID'),

    // The client secret of the Azure Data Explorer API.
    'client_secret' => env('AZURE_DATA_EXPLORER_CLIENT_SECRET'),

    // The cache driver to use for caching responses.
    'cache_driver' => env('AZURE_DATA_EXPLORER_CACHE_DRIVER', 'redis'),

    // The cache TTL to use for caching responses.
    'cache_ttl' => env('AZURE_DATA_EXPLORER_CACHE_TTL', 3500),

    // The cluster of the Azure Data Explorer API.
    'cluster' => env('AZURE_DATA_EXPLORER_CLUSTER'),

    // The region of the Azure Data Explorer API.
    'region' => env('AZURE_DATA_EXPLORER_REGION'),

	// The database of the Azure Data Explorer API.
	'database' => env('AZURE_DATA_EXPLORER_DATABASE'),
];

// Option A: More efficient to save and re-use the AzureDataExplorer class instance for followup queries
$de = new AzureDataExplorer();
$results = $de->query($query);

// Option B: you can use the AzureDataExplorer::queryOnce() method to perform the query
$results = AzureDataExplorer::queryOnce($query);


dump('Columns: '.implode(', ', $results->columns));
dump('Number of Results: '.count($results->data));
dump('Execution Time: '.$results->executionTime);

dump('First Row: '.print_r($results->data[0], true));
bash
php artisan vendor:publish --tag="azure-data-explorer-laravel-migrations"
php artisan migrate