PHPackages                             label-tools/php-cwr-exporter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. label-tools/php-cwr-exporter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

label-tools/php-cwr-exporter
============================

Modular Common Works Registration (CWR) exporter for PHP

v0.1.1(6mo ago)0322MITPHPPHP &gt;=8.1

Since Oct 10Pushed 2mo agoCompare

[ Source](https://github.com/label-tools/php-cwr-exporter)[ Packagist](https://packagist.org/packages/label-tools/php-cwr-exporter)[ RSS](/packages/label-tools-php-cwr-exporter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

PHP CWR
=======

[](#php-cwr)

A PHP library for generating Common Works Registration (CWR) files from simple PHP arrays as well as parsing Acknowledment files.

This library simplifies the process of creating CWR files by abstracting the complex, fixed-width format into a structured, easy-to-use builder pattern. It supports **CWR v2.2** and **CWR v2.1 (revision 8)**.

Install the library via Composer:

```
composer require labeltools/php-cwr-exporter
```

Basic Usage
-----------

[](#basic-usage)

The `CwrBuilder` provides a fluent interface to construct your CWR file. You start by selecting the CWR version, defining the sender and transaction details, then provide an array of works to be registered.

### CWR v2.2 Example

[](#cwr-v22-example)

```
use LabelTools\PhpCwrExporter\CwrBuilder;
use LabelTools\PhpCwrExporter\Enums\SenderType;
use LabelTools\PhpCwrExporter\Enums\TransactionType;
// ... other enums

$cwr = CwrBuilder::v22()
    ->senderType(SenderType::PUBLISHER)
    ->senderId('SENDER_ID')
    ->senderName('My Publishing Company')
    ->software('My Awesome App', '1.0')
    ->transaction(TransactionType::NEW_WORK_REGISTRATION->value)
    ->works([
        // ... array of work definitions
    ]);

$payload = $cwr->export();

file_put_contents('CWR_EXPORT.V22', $payload);
```

### CWR v2.1 Example

[](#cwr-v21-example)

```
use LabelTools\PhpCwrExporter\CwrBuilder;
use LabelTools\PhpCwrExporter\Enums\SenderType;
use LabelTools\PhpCwrExporter\Enums\TransactionType;
// ... other enums

$cwr = CwrBuilder::v21()
    ->senderType(SenderType::PUBLISHER)
    ->senderId('SENDER_ID')
    ->senderName('My Publishing Company')
    ->transaction(TransactionType::NEW_WORK_REGISTRATION->value)
    ->works([
        // ... array of work definitions
    ]);

$payload = $cwr->export();

file_put_contents('CWR_EXPORT.V21', $payload);
```

Acknowledgment (ACK) Parsing
----------------------------

[](#acknowledgment-ack-parsing)

Use the ACK parser to read society acknowledgment files (ACK)

```
use LabelTools\PhpCwrExporter\Acknowledgements\AckParser;

$payload = file_get_contents('CWR_ACK.V21');

$result = AckParser::auto()->parse($payload, [
    // Optional: lets the parser derive sender/receiver codes from the filename.
    'filename' => 'CW240001ABC_DEF.V21',
    // Optional: include raw record payloads (defaults to false).
    'include_payload' => true,
]);

$data = $result->toArray();
```

### ACK Output Structure

[](#ack-output-structure)

```
file:
  sender: { type, id, name, code? }
  receiver: { code? } | null
  creation_date
  creation_time
  version

groups[]:
  group_id
  acknowledgements[]:
    correlation:
      creation_date
      creation_time
      original_group_id
      original_transaction_sequence
      original_transaction_type
    work:
      submitter_creation_number
      recipient_creation_number
      creation_title
      transaction_type
      submitter_work_number
      iswc
    status:
      transaction_status
      processing_date
    messages[]
    payload

```

Errors during parsing raise `AckParseException` with a stable `getErrorCode()` value for tests and downstream handling.

Data Structure
--------------

[](#data-structure)

The `works()` method accepts an array of work definitions. Each work is an associative array containing details about the composition, its writers, and its publishers.

### Work Definition

[](#work-definition)

KeyTypeRequiredDescription`submitter_work_number``string`YesYour unique identifier for the work.`title``string`YesThe primary title of the work.`title_type``TitleType` enumYesThe type of the primary title (e.g., `TitleType::ORIGINAL_TITLE`).`distribution_category``MusicalWorkDistributionCategory` enumYesThe distribution category (e.g., `MusicalWorkDistributionCategory::POPULAR`).`version_type``VersionType` enumYesThe version of the work (e.g., `VersionType::ORIGINAL_WORK`).`language``LanguageCode` enumNoThe primary language of the work.`iswc``string`NoInternational Standard Musical Work Code.`copyright_date``string` (YYYYMMDD)NoThe date of copyright.`copyright_number``string`NoThe copyright registration number.`duration``string` (HHMMSS)NoThe duration of the work.`recorded``bool`No`true` if the work has been recorded.`text_music_relationship``string`NoThe relationship between text and music.`alternate_titles``array`NoAn array of alternate title definitions.`writers``array`YesAn array of writer definitions.`publishers``array`YesAn array of publisher definitions.`recordings``array`NoOptional array of recording definitions.`performing_artists``array`NoOptional array of unique performing artist definitions; each entry emits a `PER` record capturing writers who perform the work.---

### Alternate Title Definition

[](#alternate-title-definition)

KeyTypeRequiredDescription`alternate_title``string`YesThe alternate title.`title_type``TitleType` enumYesThe type of the alternate title (e.g., `TitleType::ALTERNATIVE_TITLE`).`language_code``LanguageCode` enumNoThe language of this alternate title.---

### Writer Definition

[](#writer-definition)

KeyTypeRequiredDescription`interested_party_number``string`YesThe writer's IPI or internal ID.`last_name``string`YesThe writer's last name or full legal name.`first_name``string`NoThe writer's first name.`designation_code``WriterDesignation` enumYesThe writer's role (e.g., `WriterDesignation::COMPOSER_AUTHOR`).`controlled``bool`NoDefaults to `true`. Set `false` to emit an OWR (uncontrolled writer) instead of SWR/SWT.`publisher_interested_party_number``string`NoThe IP number of the publisher representing this writer. **Required to create a PWR link.**`ipi_name_number``string`NoThe writer's IPI Name Number.`pr_affiliation_society``SocietyCode` enumNoThe writer's Performing Rights society.`territories``array`NoAn array of writer territory definitions.---

### Other Writer Definition (OWR)

[](#other-writer-definition-owr)

If `controlled` is `false`, the writer is rendered as an `OWR` record (same layout as `SWR` but without SWT/PWR). The same fields as above apply.

---

### Writer Territory Definition

[](#writer-territory-definition)

KeyTypeRequiredDescription`tis_code``string`YesThe TIS numeric code for the territory (e.g., `213` for World).`inclusion_exclusion_indicator``string`No'I' for inclusion, 'E' for exclusion. Defaults to 'I'.`pr_collection_share``float`NoThe writer's Performing Rights collection share for this territory.`mr_collection_share``float`NoThe writer's Mechanical Rights collection share for this territory.`sr_collection_share``float`NoThe writer's Synchronization Rights collection share for this territory.---

### Publisher Definition

[](#publisher-definition)

KeyTypeRequiredDescription`interested_party_number``string`YesThe publisher's IPI or internal ID.`name``string`NoRequired for controlled publishers; leave blank when `controlled` is `false` (emits an `OPU`).`type``PublisherType` enumNoRequired for controlled publishers; optional for `OPU` records.`controlled``bool`NoDefaults to `true`. Set `false` to emit an `OPU` (Other Publisher) record instead of `SPU`.`ipi_name_number``string`NoRequired for controlled publishers; optional for `OPU` records.`tax_id``string`NoThe publisher's tax identification number.`submitter_agreement_number``string`NoYour agreement number with the publisher.`pr_affiliation_society``SocietyCode` enumNoThe publisher's Performing Rights society.`pr_ownership_share``float`NoThe publisher's Performing Rights ownership share.`mr_affiliation_society``SocietyCode` enumNoThe publisher's Mechanical Rights society.`mr_ownership_share``float`NoThe publisher's Mechanical Rights ownership share.`sr_affiliation_society``SocietyCode` enumNoThe publisher's Synchronization Rights society.`sr_ownership_share``float`NoThe publisher's Synchronization Rights ownership share.`territories``array`NoAn array of publisher territory definitions.---

### Recording Definition

[](#recording-definition)

KeyTypeRequiredDescription`first_release_date``string` (YYYYMMDD)NoDate the work was first released publicly.`first_release_duration``string` (HHMMSS)NoDuration of the first release (HHMMSS).`first_album_title``string`NoAlbum title where the work first appeared.`first_album_label``string`NoLabel that released the first album.`first_release_catalog_number``string`NoInternal catalog number for the first release.`first_release_ean``string`NoEAN-13 code for the release.`first_release_isrc``string`NoISRC for the recording of the work.`recording_format``string`No“A” for audio or “V” for video.`recording_technique``string`No“A” Analogue, “D” Digital, “U” Unknown.`media_type``string` (3)NoBIEM/CISAC media type code.Each recording definition must populate at least one of the optional fields.---

### Performing Artist Definition

[](#performing-artist-definition)

KeyTypeRequiredDescription`last_name``string`YesArtist's last name (or single name) (creates a `PER`).`first_name``string`NoArtist's first name.`ipi_name_number``string`No11-digit IPI Name Number.`ipi_base_number``string`NoIPI Base Number (1–13 alphanumeric characters).---

### Publisher Territory Definition

[](#publisher-territory-definition)

KeyTypeRequiredDescription`tis_code``string`YesThe TIS numeric code for the territory (e.g., `213` for World).`inclusion_exclusion_indicator``string`No'I' for inclusion, 'E' for exclusion. Defaults to 'I'.`pr_collection_share``float`NoThe publisher's Performing Rights collection share for this territory.`mr_collection_share``float`NoThe publisher's Mechanical Rights collection share for this territory.`sr_collection_share``float`NoThe publisher's Synchronization Rights collection share for this territory.### Example Work Data

[](#example-work-data)

```
$works = [
    [
        'submitter_work_number' => 'WORK001',
        'title' => 'A GREAT SONG',
        'title_type' => TitleType::ORIGINAL_TITLE,
        'distribution_category' => MusicalWorkDistributionCategory::POPULAR,
        'version_type'=> VersionType::ORIGINAL_WORK,
        'writers' => [[
            'interested_party_number' => 'W001',
            'last_name' => 'Writer',
            'first_name' => 'Joe',
            'designation_code' => WriterDesignation::COMPOSER_AUTHOR,
            'publisher_interested_party_number' => 'P001', // This links Joe Writer to My Publishing Co
            'territories' => [[
                'tis_code' => '213', // World
                'pr_collection_share' => 50.0,
                'mr_collection_share' => 50.0,
                'sr_collection_share' => 50.0,
            ]]
        ]],
        'publishers' => [[
            'interested_party_number' => 'P001',
            'name' => 'My Publishing Co',
            'type' => PublisherType::ORIGINAL_PUBLISHER,
            'ipi_name_number' => '123456789',
            'pr_ownership_share' => 50,
            'mr_ownership_share' => 50,
            'sr_ownership_share' => 50,
            'territories' => [[
                'tis_code' => '213', // World
                'pr_collection_share' => 100.0,
                'mr_collection_share' => 100.0,
                'sr_collection_share' => 100.0,
            ]]
        ]]
    ]
];
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance76

Regular maintenance activity

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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 ~10 days

Total

2

Last Release

208d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ad27ca0216ee3b9794f88c98caec163ac04386218f12a820a025f015a4b7607?d=identicon)[juliancc](/maintainers/juliancc)

---

Top Contributors

[![juliancc](https://avatars.githubusercontent.com/u/455494?v=4)](https://github.com/juliancc "juliancc (112 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/label-tools-php-cwr-exporter/health.svg)

```
[![Health](https://phpackages.com/badges/label-tools-php-cwr-exporter/health.svg)](https://phpackages.com/packages/label-tools-php-cwr-exporter)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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