PHPackages                             micahdshackelford/rmap-laravel - 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. micahdshackelford/rmap-laravel

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

micahdshackelford/rmap-laravel
==============================

External relationship mapping tool

v1.0.0(2y ago)04[1 PRs](https://github.com/MicahDShackelford/rmap-laravel/pulls)MITPHPPHP 8.0|^8.1

Since May 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/MicahDShackelford/rmap-laravel)[ Packagist](https://packagist.org/packages/micahdshackelford/rmap-laravel)[ Docs](https://github.com/micahdshackelford/rmap-laravel)[ RSS](/packages/micahdshackelford-rmap-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (3)Used By (0)

External relationship mapping tool
==================================

[](#external-relationship-mapping-tool)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d665ec08d238acc1b260c3f0cba872215015ed7397bbd51a8a052b8389de9f38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6963616864736861636b656c666f72642f726d61702d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/micahdshackelford/rmap-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/44c7eec1f9e9adf058466a8f0fe2ec584b4c674709d3c76c669470f82a619eda/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6963616864736861636b656c666f72642f726d61702d6c61726176656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/micahdshackelford/rmap-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/e957d0712c78551e332a265d382fc3f021f1393fbf1612941d9fcf7293f5338c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6963616864736861636b656c666f72642f726d61702d6c61726176656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/micahdshackelford/rmap-laravel/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/9a81460504cf60c430b623875c14e5897c2014799439f3e8ac3b1bf1c08ace5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6963616864736861636b656c666f72642f726d61702d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/micahdshackelford/rmap-laravel)

Adds the ability to specify external foreign keys in database migrations.

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

[](#installation)

You can install the package via composer:

```
composer require micahdshackelford/rmap-laravel
```

Register the service provider:

*in `config/app.php`*

```
    'providers' => [
        ...
        /*
         * Package Service Providers...
         */
        MicahDShackelford\RmapLaravel\RmapLaravelServiceProvider::class,
        ...
    ]
```

Run the migration: `0000_00_00_000000_create_rmap_relationships_table.php`

Usage
-----

[](#usage)

### Creating a foreign relationship (from migration)

[](#creating-a-foreign-relationship-from-migration)

1. Create a new migration: `php artisan make:migration [name] --create [table]`
2. Define an column &amp; external foreign key relationship

```
...
Schema::create('[table]', function (Blueprint $table) {
    ...
    $table->uuid('external_uuid');
    ...

    $table->externalForeign('test_uuid') // Name of the column on this table
        ->connection('external_connection') // External connection name
        ->on('tests') // External table
        ->references('uuid') // External column
        ->schema("default"); // (optional) Schema the external table.column lives on
});
...
```

### Creating a foreign relationship (from command)

[](#creating-a-foreign-relationship-from-command)

Use `php artisan rmap:create` and follow the prompts.

### Dropping a foreign relationship (from migration)

[](#dropping-a-foreign-relationship-from-migration)

1. Create a roll migration: `php artisan make:migration [name] --table [table]`
2. Define an column &amp; external foreign key relationship

```
...
Schema::table('[table]', function (Blueprint $table) {
    $table->dropExternalForeign('test_uuid'); // Name of the column on this table
        // ->connection('external_connection') // (optional) External connection name
        // ->on('tests') // (optional) External table
        // ->references('uuid') // (optional) External column
        // ->schema("default"); // (optional) Schema the external table.column lives on
});
...
```

### Clear all foreign relationships (from command)

[](#clear-all-foreign-relationships-from-command)

Use `php artisan rmap:clear` and follow the prompts.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Micah Shackelford](https://github.com/MicahDShackelford)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.3% 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

Unknown

Total

1

Last Release

1084d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7486521e1f95051d02fa80dab81474c1d266980751196d4b913160368fd90bdf?d=identicon)[MicahDShackelford](/maintainers/MicahDShackelford)

---

Top Contributors

[![mdshack](https://avatars.githubusercontent.com/u/37004539?v=4)](https://github.com/mdshack "mdshack (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelMicahDShackelfordrmap-laravel

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/micahdshackelford-rmap-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/micahdshackelford-rmap-laravel/health.svg)](https://phpackages.com/packages/micahdshackelford-rmap-laravel)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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