PHPackages                             maxiewright/ttdf-orbat - 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. maxiewright/ttdf-orbat

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

maxiewright/ttdf-orbat
======================

ORBAT reference data for the Trinidad and Tobago Defence Force

v0.4.0(1mo ago)0451[1 PRs](https://github.com/maxiewright/ttdf-orbat/pulls)MITPHPPHP ^8.4CI passing

Since Mar 25Pushed 1mo agoCompare

[ Source](https://github.com/maxiewright/ttdf-orbat)[ Packagist](https://packagist.org/packages/maxiewright/ttdf-orbat)[ Docs](https://github.com/maxiewright/ttdf-orbat)[ GitHub Sponsors]()[ RSS](/packages/maxiewright-ttdf-orbat/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (4)Dependencies (30)Versions (8)Used By (0)

ORBAT Reference Data for the Trinidad and Tobago Defence Force
==============================================================

[](#orbat-reference-data-for-the-trinidad-and-tobago-defence-force)

![Tests](https://camo.githubusercontent.com/d6fed2fe1da7b0e38f8510b7535099662b0c826ae5e2a77633ed5371642976a6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d31363625323070617373696e672d627269676874677265656e)![PHPStan](https://camo.githubusercontent.com/2de44fa415e74513b3ab0978012f8b4bb8e37dafe58e2d27f779705b278f0373/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230352d627269676874677265656e)![PHP](https://camo.githubusercontent.com/73ef36a03e88ffed2a93cdf66468720c551168579fa01918500e5388bded218a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e342d626c7565)![Laravel](https://camo.githubusercontent.com/effdbaf26d88404cc8ca30c6252588a2318728c0601a4d940a4ccad911e7a6e7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125323025374325323031322d626c7565)

A Laravel package providing structured ORBAT (Order of Battle) reference data for the Trinidad and Tobago Defence Force. Covers formations, ranks (all three services), unit trees, vessel details, base locations, attachment tracking, and establishment appointments.

Installation
------------

[](#installation)

```
composer require maxiewright/ttdf-orbat
```

Publish and run migrations:

```
php artisan vendor:publish --tag="ttdf-orbat-migrations"
php artisan migrate
```

Seed the reference data:

```
php artisan ttdf-orbat:seed
```

Publishing Assets
-----------------

[](#publishing-assets)

```
# Config
php artisan vendor:publish --tag="ttdf-orbat-config"

# Seeders (to customise or extend)
php artisan vendor:publish --tag="ttdf-orbat-seeders"

# Model factories (for testing in your application)
php artisan vendor:publish --tag="ttdf-orbat-factories"
```

Facade API
----------

[](#facade-api)

The `TtdfOrbat` facade provides cached, convenient access to all ORBAT data:

```
use MaxieWright\TtdfOrbat\Facades\TtdfOrbat;

// All active formations
TtdfOrbat::formations();

// Single formation by abbreviation
TtdfOrbat::formation('TTR');

// Ranks for a formation (ordered by seniority)
TtdfOrbat::ranks('TTR');

// Filter by category
TtdfOrbat::officers('TTCG');
TtdfOrbat::otherRanks('TTAG');

// All rank grades (cross-service equivalence table)
TtdfOrbat::grades();

// Unit tree (top-level units with children eager-loaded)
TtdfOrbat::tree('TTR');

// All active units for a formation (flat)
TtdfOrbat::units('TTR');

// Appointments for a unit (by abbreviation or model)
TtdfOrbat::appointments('1TTR');
TtdfOrbat::commandAppointments('1TTR');

// Data version
TtdfOrbat::version(); // "0.1.0"
```

Cache TTL is configurable in `config/ttdf-orbat.php`. Set `cache_ttl` to `0` to disable.

Models
------

[](#models)

ModelPurpose`Formation`Service branches (TTR, TTCG, TTAG, TTDFR)`RankGrade`Cross-service rank equivalence grades (17 grades)`Rank`Formation-specific rank titles and abbreviations`Unit`Hierarchical unit tree with adjacency list support`UnitDetail`Vessel specs, base locations, coordinates (polymorphic)`UnitAttachment`Temporary attachment/detachment tracking with history`Appointment`Establishment posts within a unit (the slot, not the holder)### Unit Tree Traversal

[](#unit-tree-traversal)

Units use the `staudenmeir/laravel-adjacency-list` package for recursive queries:

```
$battalion = Unit::where('abbreviation', '1TTR')->first();

// Full subtree
$battalion->descendants;

// Ancestors to root
$platoon->ancestors;

// Breadcrumb string: "RHQ > 1TTR > A COY > 1 PL"
$platoon->breadcrumb;

// Effective parent (respects active attachments for detachments)
$detachment->effectiveParent;
```

### Appointments

[](#appointments)

An appointment is a named establishment post within a unit — the *slot*, not the person filling it. Appointments are defined by `NodeType`, and running (or re-running) the seeder applies these templates to all units, including any new units you have added.

```
use MaxieWright\TtdfOrbat\Models\Unit;

$battalion = Unit::where('abbreviation', '1TTR')->first();

// All appointments for this unit
$battalion->appointments;

// Via facade (cached, eager-loads rank grades)
TtdfOrbat::appointments('1TTR');

// Command appointments only (CO, OC, Pl Comd, etc.)
TtdfOrbat::commandAppointments($battalion);

// Accessors
$appointment->full_title;  // "CO (Commanding Officer)"
$appointment->rank_range;  // "OF-3 – OF-4"
```

#### TTR Formation Appointments

[](#ttr-formation-appointments)

\#TitleAbbrCategoryTypeRank Range0Commanding OfficerCOCommissionedCommandOF-7 – OF-81Deputy Commanding OfficerDCOCommissionedCommandOF-6 – OF-72Senior Staff OfficerSSOCommissionedStaffOF-5 – OF-63Personnel OfficerG1CommissionedStaffOF-4 – OF-54Legal OfficerLOCommissionedStaffOF-3 – OF-45Human Resource OfficerHROCommissionedStaffOF-3 – OF-46Education OfficerEOCommissionedStaffOF-3 – OF-47Intelligence OfficerG2CommissionedStaffOF-4 – OF-58Operations OfficerG3CommissionedStaffOF-4 – OF-59Logistics OfficerG4CommissionedStaffOF-4 – OF-510Projects OfficerG5CommissionedStaffOF-4 – OF-511ICT OfficerG6CommissionedStaffOF-4 – OF-512Regiment Signals OfficerRSOCommissionedStaffOF-4 – OF-513Public Relations OfficerG8CommissionedStaffOF-4 – OF-514Welfare OfficerG9CommissionedStaffOF-4 – OF-515Regimental Command Warrant OfficerRCWOWarrant OfficerAdministrativeWO-2Enums
-----

[](#enums)

EnumValues`FormationType``regiment`, `coast_guard`, `air_guard`, `reserve`, `joint``NodeType``force`, `formation`, `headquarters`, `battalion`, `company`, `platoon`, `section`, `vessel`, `squadron`, `flight`, `station`, `wing`, `flotilla`, `detachment`, `base`, `installation`, `directorate`, `department`, `branch`, `unit``RankCategory``OF` (commissioned), `WO` (warrant), `OR` (other ranks)`AppointmentType``command`, `staff`, `technical`, `administrative`, `medical`, `chaplain`, `legal``AppointmentCategory``commissioned`, `warrant_officer`, `other_ranks`, `civilian``ServiceBranch``army`, `navy`, `air`, `joint``UnitStatus``active`, `reserve`, `decommissioned`, `disbanded``VesselType``opv`, `cpv`, `fpc`, `fcs`, `interceptor`Rank Structure
--------------

[](#rank-structure)

Ranks are sourced from the [Wikipedia TTDF military ranks](https://en.wikipedia.org/wiki/Military_ranks_of_Trinidad_and_Tobago) reference. The package uses 17 abstract rank grades with formation-specific titles:

GradeTTR (Army)TTCG (Coast Guard)TTAG (Air Guard)OF-8Major GeneralRear AdmiralAir Vice MarshalOF-7Brigadier GeneralCommodoreAir CommodoreOF-6ColonelCaptainGroup CaptainOF-5Lieutenant ColonelCommanderWing CommanderOF-4MajorLieutenant CommanderSquadron LeaderOF-3CaptainLieutenantFlight LieutenantOF-2LieutenantSub-LieutenantFlying OfficerOF-1Second LieutenantActing Sub-LieutenantPilot OfficerOF-DOfficer CadetMidshipmanOfficer CadetOF-D1--Officer Cadet--OR-5Staff SergeantChief Petty OfficerSergeantOR-4SergeantPetty OfficerCorporalOR-3CorporalLeading SeamanSenior TechnicianOR-2Lance CorporalAble SeamanSenior AircraftmanOR-1PrivateOrdinary SeamanJunior AircraftmanWO-2Warrant Officer Class 1Fleet Chief Petty OfficerWarrant Officer Class 1WO-1Warrant Officer Class 2--Warrant Officer Class 2Each formation has 16 ranks (skipping one grade that doesn't apply to their service).

TTR Unit Tree
-------------

[](#ttr-unit-tree)

The Regiment unit seeder provides:

```
TTR (Trinidad and Tobago Regiment)
├── 1Engr (1st Engineer Battalion)
│   ├── Spt Sqn (Support Squadron)
│   ├── Fld Con Sqn (Field and Construction Squadron)
│   └── EME Sqn (Electrical and Mechanical Engineering Squadron)
├── 1TTR (1st Infantry Battalion)
│   ├── RHQ 1TTR (Regiment Headquarters)
│   ├── HQ 1TTR (Headquarter Company)
│   ├── A Coy (Alpha Company)
│   │   ├── HQ A Coy, 1 Plt, 2 Plt, 3 Plt
│   ├── B Coy (Bravo Company)
│   │   ├── HQ B Coy, 4 Plt, 5 Plt, 6 Plt
│   ├── C Coy (Charlie Company)
│   │   ├── HQ C Coy, 7 Plt, 8 Plt, 9 Plt
│   └── SFOD (Special Forces Operations Detachment)
├── 2TTR (2nd Infantry Battalion)
│   ├── HQ 2TTR (Headquarter Company)
│   ├── E Coy (Echo Company)
│   │   ├── HQ E Coy, 13 Plt, 14 Plt, 15 Plt
│   ├── F Coy (Foxtrot Company)
│   │   ├── HQ F Coy, 16 Plt, 17 Plt, 18 Plt
│   ├── G Coy (Gulf Company)
│   │   ├── HQ G Coy, 19 Plt, 20 Plt, 21 Plt
│   └── Sp Wpns (Support Weapons Operations Detachment)
└── SSB (Support and Service Battalion)
    ├── HQ SSB (Headquarter Company)
    ├── S&T Coy (Supply and Transport Company)
    └── Mn Coy (Maintenance Company)

```

Artisan Commands
----------------

[](#artisan-commands)

```
# Seed ORBAT data (use --fresh to truncate first)
php artisan ttdf-orbat:seed
php artisan ttdf-orbat:seed --fresh

# Display stats summary
php artisan ttdf-orbat:stats

# Render unit tree for a formation
php artisan ttdf-orbat:tree TTR
php artisan ttdf-orbat:tree TTR --depth=2
php artisan ttdf-orbat:tree TTR --status=all

# Validate data integrity
php artisan ttdf-orbat:validate
```

Model Factories
---------------

[](#model-factories)

Factories are available for all models. Use them directly or publish to your application:

```
php artisan vendor:publish --tag="ttdf-orbat-factories"
```

```
use MaxieWright\TtdfOrbat\Models\Formation;
use MaxieWright\TtdfOrbat\Models\Unit;
use MaxieWright\TtdfOrbat\Models\Rank;
use MaxieWright\TtdfOrbat\Models\RankGrade;
use MaxieWright\TtdfOrbat\Models\UnitDetail;
use MaxieWright\TtdfOrbat\Models\UnitAttachment;

// Create a formation
$formation = Formation::factory()->regiment()->create();

// Build a unit tree
$bn = Unit::factory()->battalion()->create(['formation_id' => $formation->id]);
$coy = Unit::factory()->company()->childOf($bn)->create();
$plt = Unit::factory()->platoon()->childOf($coy)->create();

// Vessel with details
$vessel = Unit::factory()->vessel()->create(['formation_id' => $formation->id]);
$detail = UnitDetail::factory()->forVessel($vessel)->create();

// Base with coordinates
$base = Unit::factory()->headquarters()->create(['formation_id' => $formation->id]);
$detail = UnitDetail::factory()->forBase($base)->create();

// Rank with grade
$grade = RankGrade::factory()->officer()->create();
$rank = Rank::factory()->create([
    'rank_grade_id' => $grade->id,
    'formation_id' => $formation->id,
]);

// Attachment (current and historical)
$attachment = UnitAttachment::factory()->create([
    'unit_id' => $plt->id,
    'attached_to_id' => $bn->id,
]);
$ended = UnitAttachment::factory()->ended()->create();

// Appointment
use MaxieWright\TtdfOrbat\Models\Appointment;

$co = Appointment::factory()->command()->create([
    'unit_id' => $bn->id,
    'title' => 'Commanding Officer',
    'abbreviation' => 'CO',
]);
```

### Factory States Reference

[](#factory-states-reference)

FactoryStates`FormationFactory``regiment()`, `coastGuard()`, `airGuard()`, `inactive()``RankGradeFactory``officer()`, `warrant()`, `otherRanks()``RankFactory`*(auto-creates grade and formation)*`UnitFactory``childOf($parent)`, `battalion()`, `company()`, `platoon()`, `headquarters()`, `vessel()`, `detachment()`, `decommissioned()`, `disbanded()``UnitDetailFactory``forVessel($unit)`, `forBase($unit)``UnitAttachmentFactory``ended()`, `withAuthority($string)``AppointmentFactory``command()`, `inactive()`Testing &amp; Static Analysis
-----------------------------

[](#testing--static-analysis)

```
composer test               # Pest test suite
composer test-coverage      # With coverage report
composer analyse            # PHPStan level 5
composer format             # Laravel Pint
```

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

[](#requirements)

- PHP ^8.4
- Laravel 11 or 12

Upgrading
---------

[](#upgrading)

When updating the package to a new version that includes seeder changes (new appointments, updated unit data, etc.), re-run the seeder to pull in the latest reference data:

```
composer update maxiewright/ttdf-orbat

# Publish any new migrations and run them
php artisan vendor:publish --tag="ttdf-orbat-migrations"
php artisan migrate

# Re-seed (idempotent — safe to run on existing data)
php artisan ttdf-orbat:seed

# Or fresh seed (truncates all ORBAT tables first)
php artisan ttdf-orbat:seed --fresh
```

Roadmap
-------

[](#roadmap)

- TTCG unit seeder (vessels, stations, Coast Guard HQ)
- TTAG unit seeder (flights, squadrons, Air Guard HQ)
- TTCG/TTAG appointment seeders
- TTDFR unit and rank seeders
- Filament admin panel integration

License
-------

[](#license)

MIT

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance94

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.9% 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 ~15 days

Total

5

Last Release

31d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01df7160f037b372732c65fc33626f5e3ace6ad1b8afe1d5cbdb1bb3e372b818?d=identicon)[MaxieWright](/maintainers/MaxieWright)

---

Top Contributors

[![maxiewright](https://avatars.githubusercontent.com/u/32748178?v=4)](https://github.com/maxiewright "maxiewright (46 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (1 commits)")

---

Tags

Maxie WrightTrinidad and Tobago Defence ForceTrinidad and Tobago RegimentTrinidad and Tobago Coast GuardTrinidad and Tobago Air GuardTrinidad and Tobago Defence Force Reservesttdfttdf-orbat

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/maxiewright-ttdf-orbat/health.svg)

```
[![Health](https://phpackages.com/badges/maxiewright-ttdf-orbat/health.svg)](https://phpackages.com/packages/maxiewright-ttdf-orbat)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

328482.0k25](/packages/codewithdennis-filament-select-tree)[nativephp/desktop

NativePHP for Desktop

38133.6k8](/packages/nativephp-desktop)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[tapp/filament-form-builder

User facing form builder using Filament components

141.9k2](/packages/tapp-filament-form-builder)

PHPackages © 2026

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