PHPackages                             stormgeo/advisorcore - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. stormgeo/advisorcore

ActiveLibrary[API Development](/categories/api)

stormgeo/advisorcore
====================

The SDK to use Advisor Core API.

v1.4.0(2mo ago)05MITPHPPHP &gt;=7.0

Since Jan 21Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/StormGeo/advisor-php-sdk)[ Packagist](https://packagist.org/packages/stormgeo/advisorcore)[ RSS](/packages/stormgeo-advisorcore/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)DependenciesVersions (9)Used By (0)

PHP SDK
=======

[](#php-sdk)

Advisor Software Development Kit for PHP.

Contents
--------

[](#contents)

- [PHP SDK](#php-sdk)
    - [How to get your token](https://www.climatempoconsultoria.com.br/contato/)
    - [Contents](#contents)
    - [Installation](#installation)
    - [Routes](#routes)
        - [Examples](#examples)
            - [Chart:](#chart)
            - [Climatology:](#climatology)
            - [Current Weather:](#current-weather)
            - [Forecast:](#forecast)
            - [Monitoring:](#monitoring)
            - [Observed:](#observed)
            - [Stations:](#stations)
            - [Plan Information:](#plan-information)
            - [Pmtiles:](#pmtiles)
            - [Schema/Parameter:](#schemaparameter)
            - [Static Map:](#static-map)
            - [Storage:](#storage)
            - [Tms (Tiles Map Server):](#tms-tiles-map-server)
    - [Headers Configuration](#headers-configuration)
    - [Response Format](#response-format)
    - [Payload Types](#payload-types)
        - [WeatherPayload](#weatherpayload)
        - [StationPayload](#stationpayload)
        - [StationsLastDataPayload](#stationslastdatapayload)
        - [ClimatologyPayload](#climatologypayload)
        - [CurrentWeatherPayload](#currentweatherpayload)
        - [RadiusPayload](#radiuspayload)
        - [GeometryPayload](#geometrypayload)
        - [PmtilesPayload](#pmtilespayload)
        - [TmsPayload](#tmspayload)
        - [PlanInfoPayload](#planinfopayload)
        - [PlanLocalePayload](#planlocalepayload)
        - [RequestDetailsPayload](#requestdetailspayload)
        - [StorageListPayload](#storagelistpayload)
        - [StorageDownloadPayload](#storagedownloadpayload)
        - [StaticMapPayload](#staticmappayload)

---

Installation
------------

[](#installation)

To install this package, use the following command:

```
composer require stormgeo/advisorcore
```

Make sure you're using php 7 or higher. Using earlier php versions may result in unexpected behavior or incompatibilities.

Routes
------

[](#routes)

First you need to import the SDK on your application and instancy the `AdvisorCore` class setting up your access token and needed configurations:

```
require './vendor/autoload.php';

use StormGeo\AdvisorCore\AdvisorCore;

$advisor = new AdvisorCore('');
```

### Examples

[](#examples)

#### Chart:

[](#chart)

```
use StormGeo\AdvisorCore\Payloads\WeatherPayload;

$payload = new WeatherPayload([
  'localeId' => 3477,
  'variables' => ['temperature', 'precipitation']
]);

// requesting daily forecast chart image
$response = $advisor->chart->getForecastDaily($payload);

// requesting hourly forecast chart image
$response = $advisor->chart->getForecastHourly($payload);

// requesting daily observed chart image
$response = $advisor->chart->getObservedDaily($payload);

// requesting hourly observed chart image
$response = $advisor->chart->getObservedHourly($payload);

if (is_null($response->error)) {
  $file = fopen('chart.png', 'wb');
  fwrite($file, $response->data);
  fclose($file);
} else {
  print_r($response->error);
}
```

#### Climatology:

[](#climatology)

```
use StormGeo\AdvisorCore\Payloads\ClimatologyPayload;

$climatologyPayload = new ClimatologyPayload([
  'localeId' => 3477,
  'variables' => ['precipitation']
]);

// requesting daily climatology data
$response = $advisor->climatology->getDaily($climatologyPayload);

// requesting monthly climatology data
$response = $advisor->climatology->getMonthly($climatologyPayload);

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Current Weather:

[](#current-weather)

```
use StormGeo\AdvisorCore\Payloads\CurrentWeatherPayload;

$payload = new CurrentWeatherPayload([
  'localeId' => 3477,
  'variables' => ['temperature', 'precipitation']
]);

$response = $advisor->currentWeather->get($payload);

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Forecast:

[](#forecast)

```
use StormGeo\AdvisorCore\Payloads\WeatherPayload;

$payload = new WeatherPayload([
  'localeId' => 3477,
  'variables' => ['temperature', 'precipitation']
]);

// requesting daily forecast data
$response = $advisor->forecast->getDaily($payload);

// requesting hourly forecast data
$response = $advisor->forecast->getHourly($payload);

// requesting period forecast data
$response = $advisor->forecast->getPeriod($payload);

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Monitoring:

[](#monitoring)

```
$response = $advisor->monitoring->getAlerts();

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Observed:

[](#observed)

```
use StormGeo\AdvisorCore\Payloads\WeatherPayload;
use StormGeo\AdvisorCore\Payloads\GeometryPayload;
use StormGeo\AdvisorCore\Payloads\RadiusPayload;
use StormGeo\AdvisorCore\Payloads\StationPayload;

$payload = new WeatherPayload([
  'localeId' => 3477,
  'variables' => ['temperature', 'precipitation']
]);

// requesting daily observed data
$response = $advisor->observed->getDaily($payload);

// requesting hourly observed data
$response = $advisor->observed->getHourly($payload);

// requesting period observed data
$response = $advisor->observed->getPeriod($payload);

$stationPayload = new StationPayload([
  'stationId' => 'bWV0b3M6MDEyMEM5RkU6LTIzLjkzMDY4NDotNDYuNDg4NTQ4'
]);

// requesting station observed data
$response = $advisor->observed->getStationData($stationPayload);

$radiusPayload = new RadiusPayload([
  'localeId' => 3477,
  'radius' => 10000
]);

// requesting fire-focus observed data
$response = $advisor->observed->getFireFocus($radiusPayload);

// requesting lightning observed data
$response = $advisor->observed->getLightning($radiusPayload);

$geometryPayload = new GeometryPayload([
  'startDate' => '2024-11-28 00:00:00',
  'endDate' => '2024-11-28 12:59:59',
  'geometry' => '{"type": "MultiPoint", "coordinates": [[-41.88, -22.74]]}'
]);

// requesting fire-focus observed data by geometry
$response = $advisor->observed->getFireFocusByGeometry($geometryPayload);

// requesting lightning observed data by geometry
$response = $advisor->observed->getLightningByGeometry($geometryPayload);

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Stations:

[](#stations)

```
use StormGeo\AdvisorCore\Payloads\StationsLastDataPayload;

$payload = new StationsLastDataPayload([
  'stationIds' => ['station-id-1', 'station-id-2'], // optional
  'variables' => ['temperature', 'precipitation'] // optional
]);

// requesting last data from stations
$response = $advisor->stations->getLastData($payload);

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Plan Information:

[](#plan-information)

```
$payload = new PlanInfoPayload([
  'timezone' => -3  # default timezone is 0 (UTC)
]);

$payloadForRequestDetails = new RequestDetailsPayload([
  'page' => 1,
  'pageSize' => 3
]);

$localePayload = new PlanLocalePayload([
  'localeId' => 3477,
  // You can also set Latitude/Longitude or StationId instead of LocaleId
]);

// requesting plan information
$response = $advisor->plan->getInfo($payload);

// requesting access history
$response = $advisor->plan->getRequestDetails($payloadForRequestDetails);

// requesting plan locale information
$response = $advisor->plan->getLocale($localePayload);

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Schema/Parameter:

[](#schemaparameter)

```
// Arbitrary example on how to define a schema
$schemaPayload = [
  'identifier' => 'arbitraryIdentifier',
  'arbitraryField1' => [
    'type' => 'string',
    'required' => 'true',
    'length' => 125,
  ],
];

// Arbitrary example on how to upload data to parameters from schema
$parametersPayload = [
  'identifier' => 'arbitraryIdentifier',
  'arbitraryField1' => 'some text',
];

// requesting all schemas from token
$response = $advisor->schema->getDefinition();

// requesting to upload a new schema
$response = $advisor->schema->postDefinition($schemaPayload);

// requesting to upload data to parameters from schema
$response = $advisor->schema->postParameters($parametersPayload);

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Static Map:

[](#static-map)

```
$payload = new StaticMapPayload([
  'startDate' => '2025-07-21 00:00:00',
  'endDate' => '2025-07-25 23:59:59',
  'aggregation' => 'sum',
  'dpi' => 100,
  'title' => 'true',
  'titlevariable' => 'precipitation',
  'type' => 'periods',
  'category' => 'observed',
  'variable' => 'precipitation'
]);

$response = $advisor->staticMap->getStaticMap($payload);

if (is_null($response->error)) {
  $file = fopen('staticMap.png', 'wb');
  fwrite($file, $response->data);
  fclose($file);
} else {
  print_r('Error trying to get data!');
  print_r($response->error);
}
```

#### Storage:

[](#storage)

```
$payloadForListing = new StorageListPayload([
  'page' => 1,
  'pageSize' => 5
]);

$payloadForDownload = new StorageDownloadPayload([
  'fileName' => 'Example.pdf',
  'accessKey' => 'a1b2c3d4-0010'
]);

# requesting the files list
$response = $advisor->storage->listFiles($payloadForListing);

if (is_null($response->error)) {
  print_r($response->data);
} else {
  print_r("Error trying to get data!");
  print_r($response->error);
}

# downloading a file from the list
$response = $advisor->storage->downloadFile($payloadForDownload);

if (is_null($response->error)) {
  $file = fopen($payloadForDownload->fileName, 'wb');
  fwrite($file, $response->data);
  fclose($file);
} else {
  print_r("Error trying to get file!");
  print_r($response->error);
}

# downloading a file by stream
$response = $advisor->storage->downloadFileByStream($downloadPayload);

if (is_null($response->error)) {
  $file = fopen($payloadForDownload->fileName, 'wb');
  if (is_resource($response->data)) {
    stream_copy_to_stream($response->data, $file);
  } else {
    fwrite($file, $response->data);
  }
  fclose($file);
} else {
  print_r("Error trying to get file!");
  print_r($response->error);
}
```

#### Tms (Tiles Map Server):

[](#tms-tiles-map-server)

```
use StormGeo\AdvisorCore\Payloads\TmsPayload;

$payload = new TmsPayload([
  'istep' => '2025-01-24 10:00:00',
  'fstep' => '2025-01-25 12:00:00',
  'server' => 'a',
  'mode' => 'forecast',
  'variable' => 'precipitation',
  'aggregation' => 'sum',
  'x' => 2,
  'y' => 3,
  'z' => 4,
  'timezone' => -3  # default timezone is 0 (UTC)
]);

$response = $advisor->tms->get($payload);

if (is_null($response->error)) {
  $file = fopen('tile.png', 'wb');
  fwrite($file, $response->data);
  fclose($file);
} else {
  print_r($response);
}
```

#### Pmtiles:

[](#pmtiles)

```
use StormGeo\AdvisorCore\Payloads\PmtilesPayload;

$payload = new PmtilesPayload([
  'mode' => 'forecast',
  'model' => 'ct2w15_as',
  'aggregation' => 'sum',
  'variable' => 'precipitation',
  'istep' => '2026-03-06 00:00:00',
  'fstep' => '2026-03-06 01:00:00',
  'maxZoom' => 4,
  'timezone' => -3  # optional, default timezone is 0 (UTC)
]);

$response = $advisor->pmtiles->get($payload);

if (is_null($response->error)) {
  $file = fopen('layer.pmtiles', 'wb');
  fwrite($file, $response->data);
  fclose($file);
} else {
  print_r($response);
}
```

Headers Configuration
---------------------

[](#headers-configuration)

You can also set headers to translate the error descriptions or to receive the response in a different format type. This functionality is only available for some routes, consult the API documentation to find out which routes have this functionality.

Available languages:

- en-US (default)
- pt-BR
- es-ES

Available response types:

- application/json (default)
- application/xml
- text/csv

Example:

```
use StormGeo\AdvisorCore\AdvisorCore;

$advisor = new AdvisorCore('invalid-token');

$advisor->setHeaderAccept('application/xml');
$advisor->setHeaderAcceptLanguage('es-ES');

$response = $advisor->plan->getInfo();

print_r($response->error);

//
//
//     UNAUTHORIZED_ACCESS
//     UNAUTHORIZED_REQUEST
//     La solicitud no está autorizada.
//
//
```

Response Format
---------------

[](#response-format)

All the methods returns the same pattern:

```
{
  "data": array|string|null,
  "error": array|string|null,
}
```

Payload Types
-------------

[](#payload-types)

### WeatherPayload

[](#weatherpayload)

- **localeId**: string
- **stationId**: string
- **latitude**: float
- **longitude**: float
- **timezone**: int
- **variables**: array
- **startDate**: string
- **endDate**: string

### StationPayload

[](#stationpayload)

- **stationId**: string
- **layer**: string
- **timezone**: int
- **variables**: array
- **startDate**: string
- **endDate**: string

### StationsLastDataPayload

[](#stationslastdatapayload)

- **stationIds**: array (optional)
- **variables**: array (optional)

### ClimatologyPayload

[](#climatologypayload)

- **localeId**: string
- **stationId**: string
- **latitude**: float
- **longitude**: float
- **variables**: array

### CurrentWeatherPayload

[](#currentweatherpayload)

- **localeId**: string
- **stationId**: string
- **latitude**: float
- **longitude**: float
- **timezone**: int
- **variables**: array

### RadiusPayload

[](#radiuspayload)

- **localeId**: string
- **stationId**: string
- **latitude**: float
- **longitude**: float
- **startDate**: string
- **endDate**: string
- **radius**: int

### GeometryPayload

[](#geometrypayload)

- **startDate**: string
- **endDate**: string
- **radius**: int
- **geometry**: string

### TmsPayload

[](#tmspayload)

- **server**: string
- **mode**: string
- **variable**: string
- **aggregation**: string
- **x**: int
- **y**: int
- **z**: int
- **istep**: string
- **fstep**: string
- **timezone**: int

### PmtilesPayload

[](#pmtilespayload)

- **mode**: string
- **model**: string
- **aggregation**: string
- **variable**: string
- **istep**: string
- **fstep**: string
- **maxZoom**: int
- **timezone**: int

### PlanInfoPayload

[](#planinfopayload)

- **timezone**: int

### PlanLocalePayload

[](#planlocalepayload)

- **localeId**: int
- **stationId**: string
- **latitude**: string
- **longitude**: string

### RequestDetailsPayload

[](#requestdetailspayload)

- **page**: int
- **pageSize**: int
- **path**: string
- **status**: string
- **startDate**: string
- **endDate**: string

### StorageListPayload

[](#storagelistpayload)

- **page**: int
- **pageSize**: int
- **startDate**: string
- **endDate**: string
- **fileName**: string
- **fileExtension**: string
- **fileTypes**: string\[\]

### StorageDownloadPayload

[](#storagedownloadpayload)

- **fileName**: string
- **accessKey**: string

### StaticMapPayload

[](#staticmappayload)

- **startate**: string
- **endDate**: string
- **aggregation**: string
- **model**: string
- **lonmin**: float
- **latmin**: float
- **lonmax**: float
- **latmax**: float
- **dpi**: int
- **title**: bool
- **titlevariable**: string
- **hours**: int
- **type**: string
- **category**: string
- **variable**: string

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance86

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~58 days

Total

8

Last Release

73d ago

Major Versions

v0.1.0 → v1.0.02025-02-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b88e185c2c9baa01ec43babe97e2abdb1cbd5d8b492012dd02b1209a425bc80?d=identicon)[devops-bot@stormgeo.com](/maintainers/devops-bot@stormgeo.com)

---

Top Contributors

[![thiagooliveiraaires](https://avatars.githubusercontent.com/u/128162586?v=4)](https://github.com/thiagooliveiraaires "thiagooliveiraaires (13 commits)")[![RaulAraujoMachado](https://avatars.githubusercontent.com/u/140834105?v=4)](https://github.com/RaulAraujoMachado "RaulAraujoMachado (9 commits)")[![jose-mariano-silva](https://avatars.githubusercontent.com/u/110114677?v=4)](https://github.com/jose-mariano-silva "jose-mariano-silva (8 commits)")

### Embed Badge

![Health badge](/badges/stormgeo-advisorcore/health.svg)

```
[![Health](https://phpackages.com/badges/stormgeo-advisorcore/health.svg)](https://phpackages.com/packages/stormgeo-advisorcore)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
