Skip to content

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.

License

Notifications You must be signed in to change notification settings

port-adhoc/shom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shom

Summary

Description

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.

Installation

On your PHP project, require the package:

composer require port-adhoc/shom:0.*

Usage

Example 1: save marine data into a JSON file

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();

API

### constructor

Creates a new instance of PortAdhoc\Shom.

public function __construct();

setSpot

Set the geodetic location to fetch the marine data from.

/**
 * @throws InvalidArgumentException
 */
public function setSpot(string $spot): Shom;

setLang

Set the lang in which to extract the data.

/**
 * @throws InvalidArgumentException
 * @throws UnsupportedLangException
 */
public function setLang(string $lang): Shom;

setUtc

Set the UTC.

/**
 * @throws InvalidArgumentException
 */
public function setUtc(int $utc): Shom;

SetFilePath

/**
 * @throws InvalidArgumentException
 * @throws RuntimException
 */
public function setFilePath(string $filePath): Shom;

saveFile

Save the file to the destination set using Shom->setFilePath

/**
 * @throws RuntimeException
 */
public function saveFile(): Shom;

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages