PHPackages                             hamhamfonfon/astrobin-ws - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hamhamfonfon/astrobin-ws

ActiveLibrary[API Development](/categories/api)

hamhamfonfon/astrobin-ws
========================

Astrobin WebServices for PHP projects

2.6.2(2y ago)6307[3 issues](https://github.com/HamHamFonFon/Astrobin-WebServices/issues)MITPHPPHP &gt;=8.2.0

Since May 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/HamHamFonFon/Astrobin-WebServices)[ Packagist](https://packagist.org/packages/hamhamfonfon/astrobin-ws)[ RSS](/packages/hamhamfonfon-astrobin-ws/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (44)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/0e4e56352f05d1dd496895e0b9f881d883fec6cc49624698b93f35749e6a565b/68747470733a2f2f706f7365722e707567782e6f72672f68616d68616d666f6e666f6e2f617374726f62696e2d77732f76)](//packagist.org/packages/hamhamfonfon/astrobin-ws)[![Total Downloads](https://camo.githubusercontent.com/9f0003e81232c48001c0176eba59e40bfc5c6a0773f0c825acd82040e3e6f84f/68747470733a2f2f706f7365722e707567782e6f72672f68616d68616d666f6e666f6e2f617374726f62696e2d77732f646f776e6c6f616473)](https://packagist.org/packages/hamhamfonfon/astrobin-ws)[![License](https://camo.githubusercontent.com/1c1fa13cfd8f509c752f190a9a28cf013f7d0ec7cb0f7816a7d671cc00a02b2c/68747470733a2f2f706f7365722e707567782e6f72672f68616d68616d666f6e666f6e2f617374726f62696e2d77732f6c6963656e7365)](https://packagist.org/packages/hamhamfonfon/astrobin-ws)[![CI Status](https://github.com/HamHamFonFon/Astrobin-WebServices/workflows/CI/badge.svg)](https://github.com/HamHamFonFon/Astrobin-WebServices/actions)[![codecov.io](https://camo.githubusercontent.com/7bf6dc185c322dd882d08d7065689696f7ee49747e58d9b73846ddc2bdba2a78/68747470733a2f2f636f6465636f762e696f2f67682f48616d48616d466f6e466f6e2f417374726f62696e2d57656253657276696365732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/HamHamFonFon/Astrobin-WebServices/branch/master/graphs/badge.svg?branch=master)

WebServices for Astrobin's API REST
===================================

[](#webservices-for-astrobins-api-rest)

Table of contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Introduction](#introduction)
- [Installing](#installing)
    - [Usage](#usage)
- [WebServices](#webservices)
    - [GetImage](#getimage)
    - [GetTodayImage](#gettodayimage)
    - [GetCollection](#getcollection)
    - [GetUser](#getuser)
- [Responses](#responses)
    - [Image](#image)
    - [ListImage](#listimage)
    - [Collection](#collection)
    - [ListCollection](#listcollection)
    - [Today](#today)
    - [User](#user)
- [Running the tests](#running-the-tests)
- [Contributes](#contributes)
- [Bugs and issues](#bugs-and-issues)
- [Authors](#authors)
- [Licence](#licence)

Version 2.6.2

Requirements
------------

[](#requirements)

- PHP 8.2 min or superior (oldest versions are no longer supported)
- API Key and API Secret from [Astrobin](https://www.astrobin.com/api/request-key/)

Introduction
------------

[](#introduction)

Astrobin's WebServices is a PHP library for request Astrobin's API Rest and get amazing astrophotographies hosted on [Astrobin](http://www.astrobin.com). Please read API section in ["Terms of service"](https://welcome.astrobin.com/terms-of-service)

Installing
----------

[](#installing)

You can install this package in 2 different ways.

- Basic installation; just install package from composer :

> `composer require hamhamfonfon/astrobin-ws`

Update to the newest version :

> `composer update hamhamfonfon/astrobin-ws`

If you're using old PHP versions:

- PHP 8.1

> `composer require hamhamfonfon/astrobin-ws:2.5`

- PHP 7.4 | 8.0

> `composer require hamhamfonfon/astrobin-ws:2.4`

- PHP 7.3

> `composer require hamhamfonfon/astrobin-ws:2.3`

Caution, these versions are not maintained anymore. Only 2.6.\* will be maintained and will have new features.

- If you just want to make some issues, make some simple tests etc, juste clone the repository

> `git clone git@github.com:HamHamFonFon/Astrobin-Webservices.git`

### Usage

[](#usage)

First, set your keys in .env file :

```
ASTROBIN_API_KEY=PutHereYourOwnApiKey
ASTROBIN_API_SECRET=PutHereYourOwnApiSecret
```

Example without framework:

```
# Get variables
$astrobinApiKey = getenv('ASTROBIN_API_KEY');
$astrobinApiSecret = getenv('ASTROBIN_API_SECRET');

# Get data from Astrobin
$imageWs = new GetImage($astrobinApiKey, $astrobinApiSecret);
$astrobinImage = $imageWs->getById('astrobinImageId');
```

Example with Symfony:

```
parameters:
   astrobinApiKey: '%env(ASTROBIN_API_KEY)%'
   astrobinApiSecret: '%env(ASTROBIN_API_SECRET)%'

   # default configuration for services in *this* file
   _defaults:
      autowire: true      # Automatically injects dependencies in your services.
      autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
      bind:
         $astrobinApiKey: '%astrobinApiKey%'
         $astrobinApiSecret: '%astrobinApiSecret%'
```

```
use AstrobinWs\Response\DTO\AstrobinResponse;use AstrobinWs\Services\GetImage;

final class MyImageService
{
    private GetImage $astrobinImage;

    /**
     * MyImageService constructor.
     * @param string|null $astrobinApiKey
     * @param string|null $astrobinApiSecret
    */
    public function __construct(?string $astrobinApiKey, ?string $astrobinApiSecret)
    {
        $this->astrobinImage = new GetImage($astrobinApiKey, $astrobinApiSecret);
    }

    public function getImageById(): ?AstrobinResponse
    {
        return $this->astrobinImage->getImageById('1234');
    }

    public function getOrionNebula(): ?AstrobinResponse
    {
        $orionNebula = $this->astrobinImage->getImagesBySubject('m42', 10);
        // ...
        return $orionNebula;
    }

    public function getImagesOfSiovene(): ?AstrobinResponse
    {
        $imagesBySiovene = $this->astrobinImage->getImagesByUser('siovene', 10);

        return $imagesBySiovene;
    }

    public function getImagesByManyFilters(): ?AstrobinResponse
    {
        $filters = [
            'user' => 'toto',
            'subjects' => 'm31',
            'description__icontains' => 'wind'
        ];

        $listImages = $this->astrobinImage->getImageBy($filters, 10);

        return $listImages;
    }
}
```

WebServices
-----------

[](#webservices)

The library expose 3 WebServices, each with these methods below.

### GetImage :

[](#getimage-)

Function nameParameterResponse`getById()``$id``Image``getImageById()``$id``Image``getImagesBySubject()``$subjectId` `$limit``ListImage`,`Image``getImagesByTitle()``$title` `$limit``ListImage`,`Image``getImagesByDescription()``$description` `$limit``ListImage`,`Image``getImagesByUser()``$userName` `$limit``ListImage`,`Image``getImagesByRangeDate()``$dateFromStr` (ex: 2018-04-01), `$dateToStr` (2018-04-31 or null)`ListImage`,`Image``getImageBy()``$filters` `$limit``ListImage`,`Image``getImageById()` is an alias of `getById()` for version 1.0.0. retro-compatibility.List of filters that can be used in `getImageBy()` :

Filter nameComment`subjects`Used in `getImagesBySubject()` method, search by subject`user`Used in `getImagesByUser()` method, search by username`title__icontains`Used in `getImagesByTitle()` method, search by case-insensitive, partial title`description__icontains`Used in `getImagesByDescription()` method, search by case-insensitive, partial description`__startswith``__endswith``__contains``__istartswith``__iendswith`### GetTodayImage :

[](#gettodayimage-)

Function nameParameterResponse`getDayImage()``$offset` , limit = 1`ListToday``getTodayImage()``Today`### GetCollection :

[](#getcollection-)

Function nameParameterResponse`getById()``$id``Collection`DEPRECATED `getCollectionByUser()``$user`,`$limit``ListCollection`Parameter `$limit` is mandatory and must be an integer.

### GetUser

[](#getuser)

Function nameParameterResponse`getById()``$id``User``getByUername()``$username``User`/!\\ For all webservices, parameter `$id` must be a string and not an integer or float.Responses
---------

[](#responses)

### Image

[](#image)

ParameterDescription`title`Title of image`subjects`Keywords`description`Description`url_gallery`URL of image for gallery`url_thumb`URL of image , thumb size`url_regular`URL of image`user`Username`url_histogram`URL to histogram`url_skyplot`URL to skyplot`url_solution``url_advanced_skyplot_small`URL to advanced skyplot`views`Count of views`likes`Count of likes### ListImage

[](#listimage)

ParameterDescription`listImages`List of images### Collection

[](#collection)

ParameterDescription`id`Identifier`name`Name of collection`description`Description`user` User name`date_created`Date of creation`date_updated`Date of modification`images`Path of WS Image### ListCollection

[](#listcollection)

ParameterDescription`listCollection`List of collection with list of images### Today

[](#today)

ParameterDescription`date`Date of image (Y-m-d format)`image`instance of Image::class as today`resource_uri`URI of today image### User

[](#user)

ParameterDescription`id``username``avatar``about``image_count``job``hobbies``language``website`Contributes
-----------

[](#contributes)

I accept contributions, please fork the project and submit pull requests.

Bugs and issues
---------------

[](#bugs-and-issues)

In case you find some bugs or have question about Astrobin-WebServices, open an issue and I will answer you as soon as possible.

### Install package for debugging

[](#install-package-for-debugging)

#### Retrieve code-source

[](#retrieve-code-source)

Clone repository from GitHub

```
git clone git@github.com:HamHamFonFon/Astrobin-WebServices.git
```

#### Run docker

[](#run-docker)

Build, compile and up docker container

```
docker-compose build --no-cache
docker-compose up -d
docker exec -ti php_astrobin_ws bash
```

#### Installation

[](#installation)

Install dependencies

```
composer install
```

#### Run Rector

[](#run-rector)

```
# Init
./vendor/bin/rector init

# Run
./vendor/bin/rector process src --dry-run
```

#### Run PHP CodeSnifer

[](#run-php-codesnifer)

```
php ./vendor/bin/phpcs -p -n --standard=PSR12 src

```

Apply PHPCBF (fix and beautify PHPCS errors):

```
php ./vendor/bin/phpcbf src/path/to/file.php

```

Authors
-------

[](#authors)

Stéphane Méaudre -  - 2023

Licence
-------

[](#licence)

This project is licensed under the MIT License - see the LICENSE.md file for details

Other versions
--------------

[](#other-versions)

- [VueJs version - In progress](https://github.com/HamHamFonFon/Astrobin-WebServices-VueJs)

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 98.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~67 days

Recently: every ~10 days

Total

31

Last Release

908d ago

Major Versions

0.9. → 1.0.12020-01-18

1.0.1 → 2.0.02020-12-10

PHP version history (5 changes)0.8.0PHP &gt;7.0.0

2.0.0PHP &gt;=7.3.0

2.4.0PHP &gt;=7.4.0

2.5.0PHP &gt;=8.1.0

2.6.0PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fc9b8fa5fb2b66b5c6ac357054e3e67e1e98283bbdb2d32f7b160e4e2831a7f?d=identicon)[HamHamFonFon](/maintainers/HamHamFonFon)

---

Top Contributors

[![Astro-Otter-Space](https://avatars.githubusercontent.com/u/7487421?v=4)](https://github.com/Astro-Otter-Space "Astro-Otter-Space (180 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

astrobinastrobin-apiphpwebservicesapiastronomyDeep space objectsAstrobin WebServices

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/hamhamfonfon-astrobin-ws/health.svg)

```
[![Health](https://phpackages.com/badges/hamhamfonfon-astrobin-ws/health.svg)](https://phpackages.com/packages/hamhamfonfon-astrobin-ws)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
