PHP code example of projectsaturnstudios / venusian-stargazer
1. Go to this page and download the library: Download projectsaturnstudios/venusian-stargazer 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/ */
projectsaturnstudios / venusian-stargazer example snippets
$picture = nasa()->apod()->date('2015-06-03')->get();
echo $picture->title; // "Flyby Image of Saturn's Sponge Moon Hyperion"
$flares = nasa()->donki()->flr('2017-09-06', '2017-09-06')->get();
echo $flares->first()->flrID; // "2017-09-06T08:57:00-FLR-001"
nasa()->neows()->feed()->async()
->then(fn ($feed) => printf("%d objects near Earth\n", $feed->element_count))
->error(fn (\Throwable $e) => printf("NeoWs failed: %s\n", $e->getMessage()));
$feed = nasa()->neows()->feed()->async();
$flares = nasa()->donki()->flr()->async();
printf("%d objects, %d flares\n", $feed->wait()->element_count, $flares->wait()->count());
$events = nasa()->eonet()->events()->with('status', 'open')->with('limit', 5)->get();
use ProjectSaturnStudios\Stargazer\EPIC\Enums\EpicCollection;
use ProjectSaturnStudios\Stargazer\EPIC\Enums\EpicImageType;
$image = nasa()->epic()->natural()->get()->first();
$image->render(EpicCollection::NATURAL, EpicImageType::JPG)
->then(fn ($response) => file_put_contents("{$image->image}.jpg", $response->body()));
use ProjectSaturnStudios\Stargazer\Trek\Enums\TrekBody;
use ProjectSaturnStudios\Stargazer\Trek\Enums\TrekProjection;
$kepler = nasa()->exoplanet()->planet('Kepler-22 b')->get();
printf("%s: %.1f days, %.2f Earth radii\n", $kepler->name, $kepler->orbitalPeriodDays, $kepler->radiusEarth);
$newest = nasa()->exoplanet()->planets(where: 'disc_year >= 2025', limit: 10)->get();
$moon = nasa()->trek()->layers(TrekBody::MOON)->get();
$tile = nasa()->trek()->tile(TrekBody::MOON, TrekProjection::EQUIRECTANGULAR, 'LRO_WAC_Mosaic_Global_303ppd_v02', 0, 0, 0)->get();
file_put_contents('moon-0-0-0.jpg', $tile->body());
nasa()->apod()->range('2015-06-01', '2015-06-03')->get()->pluck('title');
// "Pulsating Aurora over Iceland", "Polaris and Comet Lovejoy", "Flyby Image of Saturn's Sponge Moon Hyperion"
$rock = nasa()->neows()->lookup('3542519')->get();
$rock->name; // "(2010 PK9)"
$rock->is_potentially_hazardous_asteroid; // true
nasa()->donki()->flr('2017-09-06', '2017-09-10')->get()->pluck('classType');
// "X2.2", "X9.3", "M2.5", ... "X8.2"
use ProjectSaturnStudios\Stargazer\EONET\Enums\EonetEventStatus;
nasa()->eonet()->events()->with('status', EonetEventStatus::OPEN)->with('limit', 3)->get()->events->pluck('title');
// "Tropical Cyclone 01B", "Hurricane Polo", "Wildfire Round Prarie, Morehouse, Louisiana"
$images = nasa()->epic()->natural('2015-10-31')->get();
$images->count(); // 12
$images->first()->image; // "epic_1b_20151031003633"
$weather = nasa()->insight()->weather()->get();
$weather->solKeys; // ["675", "676", "677", "678", "679", "680", "681"]
$iss = nasa()->tle()->satellite(25544)->get();
$iss->name; // "ISS (ZARYA)"
$iss->line1; // "1 25544U 98067A 26265.85181744 .00007689 00000+0 14639-3 0 9994"
nasa()->techtransfer()->spinoff('battery')->get()->total; // 142
use ProjectSaturnStudios\Stargazer\ImageLibrary\Enums\ImageMediaType;
$page = nasa()->imageLibrary()->search('apollo 11')->with('media_type', ImageMediaType::IMAGE)->get();
$page->totalHits; // 1522
$page->items->first()->data->first()->nasaId; // "jsc2007e034221"
$location = nasa()->imageLibrary()->metadata('as11-40-5874')->get();
$location->fetch()->wait()->json('AVAIL:Title');
// "Apollo 11 Mission image - Astronaut Edwin Aldrin poses beside th"
use ProjectSaturnStudios\Stargazer\GIBS\DataObjects\GibsBox;
use ProjectSaturnStudios\Stargazer\GIBS\Enums\GibsMapFormat;
use ProjectSaturnStudios\Stargazer\GIBS\Enums\GibsTileFormat;
$wmts = nasa()->gibs()->wmts(); // EPSG:4326, best imagery
$capabilities = $wmts->capabilities()->get(); // 1,300+ layers, read as a stream
$modis = $capabilities->layer('MODIS_Terra_CorrectedReflectance_TrueColor');
$zoom2 = $capabilities->tileMatrixSetOf($modis->identifier)->matrix(2);
foreach ($zoom2->covering(new GibsBox(-30, 0, 60, 45))?->tiles() ?? [] as [$row, $col]) {
$jpeg = $wmts->tile($modis->identifier, '250m', 2, $row, $col, GibsTileFormat::JPEG, '2021-09-21')->get()->body();
}
$map = nasa()->gibs()->wms()->map('MODIS_Terra_CorrectedReflectance_TrueColor', new GibsBox(-130, 20, -60, 55), 700, 350, GibsMapFormat::PNG, '2021-09-21')->get();
$fires = $wmts->vectorTile('VIIRS_NOAA20_Thermal_Anomalies_375m_All', '500m', 4, 3, 4, '2020-10-01')->get();
bash
php computer vendor:publish --tag=nasa-config