A dumb FITS image library for PHP...
Go to file
2024-10-08 17:14:21 +02:00
src Add image blob and bitpix enum 2024-10-08 08:16:35 +02:00
.gitignore Initial commit 2024-09-24 23:03:36 +02:00
composer.json Initial commit 2024-09-24 23:03:36 +02:00
README.md Add stupid README 2024-10-08 17:14:21 +02:00

FitsPHP - A dumb FITS image library for PHP

FitsPHP (or fits-php) is a dumb and crappy "library" to somehow interact with the FITS image format used in astronomy.
The library tries to implement a reasonable subset of the FITS standard. Of course, it all depends on the definition of 'reasonable'...

Usage

Add the package with Composer:

composer require dumbastro/fits-php

then use classes from the Dumbastro\FitsPhp namespace.

Examples

Retrieve the image blob for a given FITS file then do something with the bytes:

<?php

declare(strict_types=1);

use Dumbastro\FitsPhp\Fits;
use Dumbastro\FitsPhp\FitsHeader;
use Dumbastro\FitsPhp\ImageBlob;

$fits = new Fits('bubble_nebula.fit');
$blob = new ImageBlob($header, $fits->imageBlob);

foreach ($blob->dataBytes() as $byte) {
    // Do something useful...
}

The method ImageBlob::dataBytes returns a Generator.