PHP code example of scottboms / moon-phases

1. Go to this page and download the library: Download scottboms/moon-phases 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/ */

    

scottboms / moon-phases example snippets




return [
  'scottboms.moon-phases' => [
    'api' => [
      'provider' => 'ipgeolocation',
      'key' => 'IPGEOLOCATION_API_KEY',
      'baseUrl' => 'https://api.ipgeolocation.io/astronomy',
      'timeout' => 8,
    ],
    'location' => [
      'lat' => 40.7128,
      'lng' => -74.0060,
      'timezone' => 'America/New_York',
    ],
    'cache' => [
      'ttl' => 60, // in minutes
    ],
    'icons' => [
      'mode' => 'preset', // preset | custom
      'path' => kirby()->root('index') . '/assets/moon-icons',
      'map' => [
        'new_moon' => 'new.svg',
        'waxing_crescent' => 'waxing-crescent.svg',
        'first_quarter' => 'first-quarter.svg',
        'waxing_gibbous' => 'waxing-gibbous.svg',
        'full_moon' => 'full.svg',
        'waning_gibbous' => 'waning-gibbous.svg',
        'last_quarter' => 'last-quarter.svg',
        'waning_crescent' => 'waning-crescent.svg',
      ],
    ],
  ],
];

<?= $site->moonPhase() 

 snippet('moon-phases')