PHPackages                             martincamen/php-arr-core - 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. [Image &amp; Media](/categories/media)
4. /
5. martincamen/php-arr-core

ActiveLibrary[Image &amp; Media](/categories/media)

martincamen/php-arr-core
========================

Canonical domain models and value objects for the \*arr ecosystem

0.1.4(3mo ago)0493MITPHPPHP ^8.3

Since Dec 30Pushed 3mo agoCompare

[ Source](https://github.com/MartinCamen/php-arr-core)[ Packagist](https://packagist.org/packages/martincamen/php-arr-core)[ RSS](/packages/martincamen-php-arr-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (15)Used By (3)

php-arr-core
============

[](#php-arr-core)

Important

This project is still being developed and breaking changes might occur even between patch versions.

The aim is to follow semantic versioning as soon as possible.

A canonical domain model for the \*arr ecosystem.

`php-arr-core` provides **shared domain models, value objects, enums and normalization logic**used across \*arr service SDKs such as Sonarr, Radarr, Jellyseerr and NZBGet.

The goal is to eliminate duplicated DTOs, inconsistent status handling and ad-hoc mappings between services that conceptually model the same things.

Ecosystem
---------

[](#ecosystem)

PackageDescription[radarr-php](https://github.com/martincamen/radarr-php)PHP SDK for Radarr[sonarr-php](https://github.com/martincamen/sonarr-php)PHP SDK for Sonarr[jellyseerr-php](https://github.com/martincamen/jellyseerr-php)PHP SDK for Jellyseerr[laravel-radarr](https://github.com/martincamen/laravel-radarr)Laravel integration for Radarr[laravel-sonarr](https://github.com/martincamen/laravel-sonarr)Laravel integration for Sonarr[laravel-jellyseerr](https://github.com/martincamen/laravel-jellyseerr)Laravel integration for Jellyseerr---

Why does this exist?
--------------------

[](#why-does-this-exist)

The \*arr ecosystem is highly cohesive:

- Sonarr, Radarr, Jellyseerr and NZBGet all model:
    - media (movies, series, episodes)
    - downloads (queue items)
    - file sizes
    - progress
    - statuses
- Yet each service exposes these concepts using:
    - different naming
    - different units
    - different status values
    - different lifecycle semantics

This results in:

- duplicated DTOs
- repeated status mapping logic
- fragile integrations
- inconsistent developer experience

`php-arr-core` solves this by defining **one canonical domain model**that all \*arr SDKs map to.

---

What this package is
--------------------

[](#what-this-package-is)

- ✅ Pure PHP (no framework dependencies)
- ✅ Canonical domain models
- ✅ Value objects (FileSize, Duration, Progress, etc.)
- ✅ Normalized enums and statuses
- ✅ Mapping helpers and contracts

---

Core design principles
----------------------

[](#core-design-principles)

### 1. Canonical domain &gt; API representation

[](#1-canonical-domain--api-representation)

APIs change. Domains evolve slowly.

This package models **what things are**, not how services expose them.

---

### 2. Value objects over primitives

[](#2-value-objects-over-primitives)

Anything that:

- has units
- appears in multiple services
- requires conversion or logic

...is modeled as a value object.

Examples:

- `ArrFileSize` (extends `martincamen/php-file-size`)
- `Duration`
- `Progress`

---

### 3. Status normalization is centralized

[](#3-status-normalization-is-centralized)

Each service uses its own status vocabulary.

All normalization happens **once**, in core.

SDKs should never contain `switch` or `if` blocks for statuses.

---

### 4. Mapping happens at the boundary

[](#4-mapping-happens-at-the-boundary)

Service SDKs are responsible for mapping their API DTOs into `php-arr-core` domain objects.

Core never depends on service-specific code.

---

Package structure
-----------------

[](#package-structure)

```
src/
├── Domain/
│   ├── Media/
│   ├── Download/
│   ├── Request/
│   └── User/
├── ValueObject/
│   ├── ArrFileSize.php
│   ├── Duration.php
│   ├── Progress.php
│   └── ArrId.php
├── Enum/
│   ├── MediaStatus.php
│   ├── DownloadStatus.php
│   └── Service.php
├── Mapping/
│   ├── StatusNormalizer.php
│   └── ServiceCapabilities.php

```

---

Example usage
-------------

[](#example-usage)

```
use MartinCamen\ArrCore\Domain\Download\DownloadItem;
use MartinCamen\ArrCore\ValueObject\ArrFileSize;
use MartinCamen\ArrCore\ValueObject\Progress;
use MartinCamen\ArrCore\Enum\DownloadStatus;

$item = new DownloadItem(
    id: ArrId::fromInt(123),
    name: 'Example.Movie.2024',
    size: ArrFileSize::fromGigabytes(8.5),
    progress: Progress::fromPercentage(42),
    status: DownloadStatus::Downloading
);
```

---

How service SDKs integrate
--------------------------

[](#how-service-sdks-integrate)

Each service SDK:

1. Defines API-specific DTOs
2. Fetches raw data via HTTP
3. Maps DTOs → `php-arr-core` domain models

Example:

```
use MartinCamen\Sonarr\Sonarr;

$sonarr = Sonarr::create('localhost', 8989, 'your-api-key');

// Action-based API returns typed responses
$downloads = $sonarr->downloads()->all();   // DownloadPage
$series = $sonarr->series()->all();          // SeriesCollection
$status = $sonarr->system()->status();       // SystemStatus
```

---

Supported services
------------------

[](#supported-services)

This package is designed to be used by:

- Sonarr SDK
- Radarr SDK
- Jellyseerr SDK
- NZBGet SDK
- Prowlarr SDK (planned)

---

Versioning &amp; stability
--------------------------

[](#versioning--stability)

`php-arr-core` follows semantic versioning.

Breaking changes only occur when:

- a domain concept changes
- a value object's behavior changes

New services and fields should be additive whenever possible.

---

Contributing
------------

[](#contributing)

Contributions are welcome, especially:

- new value objects
- improved normalization
- additional service mappings

Before adding new models, consider:

> Is this a domain concept or an API detail?

If unsure, open an issue.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance78

Regular maintenance activity

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

14

Last Release

117d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8720813?v=4)[Martin Camen](/maintainers/MartinCamen)[@MartinCamen](https://github.com/MartinCamen)

---

Top Contributors

[![MartinCamen](https://avatars.githubusercontent.com/u/8720813?v=4)](https://github.com/MartinCamen "MartinCamen (33 commits)")

---

Tags

automationmediaarrjellyseerrsonarrradarrnzbget

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/martincamen-php-arr-core/health.svg)

```
[![Health](https://phpackages.com/badges/martincamen-php-arr-core/health.svg)](https://phpackages.com/packages/martincamen-php-arr-core)
```

###  Alternatives

[essence/essence

Extracts information about medias on the web, like youtube videos, twitter statuses or blog articles.

770562.9k3](/packages/essence-essence)[s9e/text-formatter

Multi-purpose text formatting and markup library. Plugins offer support for BBCodes, Markdown, emoticons, HTML, embedding third-party media (YouTube, etc...), enhanced typography and more.

2413.1M29](/packages/s9e-text-formatter)[dereuromark/media-embed

A PHP library to deal with all those media services around, parsing their URLs and embedding their audio/video content in websites.

182530.3k11](/packages/dereuromark-media-embed)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[daun/statamic-mux

Seamless video encoding and streaming using Mux on Statamic sites

132.3k](/packages/daun-statamic-mux)

PHPackages © 2026

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