PHP code example of umich-its-tl / caliper-php

1. Go to this page and download the library: Download umich-its-tl/caliper-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/ */

    

umich-its-tl / caliper-php example snippets

 composer.phar install

             

            /*
             * If necessary, use set_include_path() to ensure the directory
             * containing the "vendor" directory is in the PHP include path.
             */
            

    // Create Caliper sensor object
    $sensor = new Sensor('your_sensor_id');
    // Set sensor options
    $options = (new Options())
        ->setApiKey('your_authentication_key_for_the_datastore')
        ->setDebug(true)
        ->setHost('http://example.org/dataStoreURI');
    // Register a network transport for the sensor
    $sensor->registerClient('your_http_transport_id',
        new Client('your_client_id', $options));
    // TODO: Define $yourCaliperEventObject
    // Send a Caliper event object
    $sensor->send($sensor, $yourCaliperEventObject);

    
curl -sS https://getcomposer.org/installer | php
json
                {
                    "                      "ims-global/caliper-php-public": "1.0.0"
                    }
                }
                
json
                {
                    "repositories": [
                        {
                            "type": "vcs",
                            "url": "https://github.com/IMSGlobal/caliper-php-public.git"
                        }
                    ]
                }
                
json
            "umich-its-tl/caliper-php": "1.0.1"