PHP code example of imo-tikuwa / resas-api-client

1. Go to this page and download the library: Download imo-tikuwa/resas-api-client 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/ */

    

imo-tikuwa / resas-api-client example snippets




use TikuwaApp\Api\ResasApiClient;

$api_key = '[API キー]';
$resas_api_client = new ResasApiClient($api_key);
$result = $resas_api_client->find('api/v1/cities', ['prefCode' => '13'])->toArray();



use TikuwaApp\Api\ResasApiClient;

$date = new DateTime();
$date->setTimezone(new DateTimeZone('Asia/Tokyo'));
$filename = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . basename(__FILE__, ".php") . '_' . $date->format('YmdHis') . '.php';

(new ResasApiClient())->find('api/v1/prefectures')
->setKeyValuePath("{n}[prefCode<=15].prefCode", "{n}[prefCode<=15].prefName")
->toExport($filename);