Make a call to the shom text render api to collect data, put it in form and let you save it to a JSON file.
On your PHP project, require the package:
composer require port-adhoc/shom:0.*
In this example, we are saving marine data into a json file inside the same directory as our PHP script.
// index.php
require __DIR__ . "/../vendor/autoload.php";
use PortAdhoc\Shom;
$shom = new Shom;
$shom->setSpot("Marseille")
->setLang("fr");
->setUtc(2);
->setFilePath("./marseille.json");
$shom->saveFile();
Shom->constructor()
Shom->setSpot()
Shom->setLang()
Shom->setUtc()
Shom->setFilePath()
Shom->saveFile()
### constructor
Creates a new instance of PortAdhoc\Shom
.
public function __construct();
Set the geodetic location to fetch the marine data from.
/**
* @throws InvalidArgumentException
*/
public function setSpot(string $spot): Shom;
Set the lang in which to extract the data.
/**
* @throws InvalidArgumentException
* @throws UnsupportedLangException
*/
public function setLang(string $lang): Shom;
Set the UTC.
/**
* @throws InvalidArgumentException
*/
public function setUtc(int $utc): Shom;
/**
* @throws InvalidArgumentException
* @throws RuntimException
*/
public function setFilePath(string $filePath): Shom;
Save the file to the destination set using Shom->setFilePath
/**
* @throws RuntimeException
*/
public function saveFile(): Shom;