A class library that allows you to access FITS file headers in PHP.

0.0.4 2014-06-08 03:53 UTC

This package is not auto-updated.

Last update: 2024-04-13 13:26:08 UTC


Build Status


phits - a FITS reader for PHP

FITS is the standard astronomical data format endorsed by both NASA and the IAU.

This class can read and parse header data from FITS files. I am not currently planning to add the ability to read and process the attached data as well.

The FitsThumbnail class uses the Imagick PECL library to convert FITS image data into a thumbnail of a specified size and format. It will fail horribly if you do not have Imagick installed.


  use Phits\Fits\FitsParser;

  $fits = new FitsParser('/tmp/foobar.fits');

  $headers = $fits->getHeaders();
  $naxis   = $fits->getNaxis(0);

  // Do stuff.

  use Phits\Fits\FitsThumbnail;

  $thumb = new FitsThumbnail('/tmp/foobar.fits');

  // Delete the generated thumbnail when PHP exits.

  // Create a 200x200 thumbnail.
  $thumb->createThumbnail(200, 200);

  // Get the generated thumbail file.
  $thumbnail = $thumb->getThumbnail();

  // Do stuff.


This project is based on pre-existing open source FITS libraries and I have used both of them to help me write this parser:

Phits inherits the MIT license from these other projects.

As opposed to the Go parser, Phits also handles CONTINUE headers for longer string comments.


See for more information.