PHP code example of ldubois / php-mapotempo

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

    

ldubois / php-mapotempo example snippets


$apikey   = "API_KEY"; // Your Api key
$url  = "URL"; // Your url application mapotempo
$table ="TABLE"; // A table to interact

$mapotempo = new Mapotempo($url, $apikey);

$records = $mapotempo->findRecords($table);



    $mapotempo = new Mapotempo($url, $apikey);
    $fields =
            [
                "ref" => "TEST",
                "name" => "new client",
                "street" => "12 avenue Thiers",
                "postalcode" => 33100,
                "city" => "Bordeaux",
                "country" => "France",
                "detail" => "2ème étage",
                "tag_ids" => [],
                "visits" => []
            ];
    $criteria = ["ref" => $fields["ref"]];
    $des = $mapotempo->createTableManipulator('destinations');

    if ($des->containsRecord($criteria)) {
        
        $des->updateRecord($criteria, $fields);
    } else {

        $des->createRecord($fields);
    }
bash
composer