1. Go to this page and download the library: Download harmonicdigital/ccsds 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/ */
harmonicdigital / ccsds example snippets
use HarmonicDigital\Ccsds\CcsdsClient;
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter;
$filesystem = new Filesystem(new LocalFilesystemAdapter('/path/to/data'));
$client = new CcsdsClient($filesystem);
$oemFile = $client->parseOemFile('ephemeris/H20090909_0001.LOE');
// File-level header
echo $oemFile->header->version; // e.g. "1.0"
echo $oemFile->header->originator; // e.g. "ESOC"
echo $oemFile->header->creationDate->format('Y-m-d\TH:i:s');
// File-level comments
foreach ($oemFile->comments as $comment) {
echo $comment . PHP_EOL;
}
// Segments - each covers a contiguous time range
foreach ($oemFile as $segment) {
$meta = $segment->metadata;
echo $meta->objectName; // e.g. "HERSCHEL"
echo $meta->objectId; // e.g. "2009-026A"
echo $meta->refFrame; // e.g. "EME2000"
echo $meta->timeSystem; // e.g. "TDB"
echo $meta->startTime->format('Y-m-d\TH:i:s.u');
echo $meta->stopTime->format('Y-m-d\TH:i:s.u');
// State vectors - position in km, velocity in km/s
foreach ($segment->stateVectors as $sv) {
echo $sv->epoch->format('Y-m-d\TH:i:s.u');
echo " x={$sv->x} y={$sv->y} z={$sv->z}";
echo " xDot={$sv->xDot} yDot={$sv->yDot} zDot={$sv->zDot}";
echo PHP_EOL;
}
}
// Safe to iterate multiple times at no extra I/O cost
$segments = iterator_to_array($oemFile);
$same = iterator_to_array($oemFile); // served from cache
use HarmonicDigital\Ccsds\Exception\ParseException;
use League\Flysystem\UnableToReadFile;
try {
$oemFile = $client->parseOemFile('missing_or_corrupt.oem');
foreach ($oemFile as $segment) { /* ... */ }
} catch (UnableToReadFile $e) {
// Flysystem could not open the file
} catch (ParseException $e) {
// The file content does not conform to the OEM format
}
use HarmonicDigital\Ccsds\CcsdsClient;
use HarmonicDigital\Ccsds\Parser\OemParserInterface;
$client = new CcsdsClient($filesystem, new MyCustomOemParser());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.