PHPackages                             aurorawebsoftware/connective - 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. aurorawebsoftware/connective

ActiveLibrary

aurorawebsoftware/connective
============================

This is my package connective

12.0.0(4mo ago)101.3k↓33.3%1MITPHPPHP ^8.2|^8.3CI passing

Since Oct 16Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/AuroraWebSoftware/connective)[ Packagist](https://packagist.org/packages/aurorawebsoftware/connective)[ Docs](https://github.com/aurorawebsoftware/connective)[ RSS](/packages/aurorawebsoftware-connective/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (16)Used By (1)

Laravel Connective Package Documentation
========================================

[](#laravel-connective-package-documentation)

[![img.png](img.png)](img.png)

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

[](#introduction)

The Laravel Connective package provides a simple and intuitive way to establish connections between Eloquent models. It allows you to define different connection types and manage relationships between models.

Key Concepts
------------

[](#key-concepts)

### 1. Connection Types

[](#1-connection-types)

- **Connection Types**: The package supports multiple connection types, which are defined in the package configuration. Users can connect models using one of these types.

### 2. Models

[](#2-models)

- **Connective Model**: Any Eloquent model can be used with the Connective package. To enable the package's functionality, a model must implement the `ConnectiveContract`.

### 3. Connections

[](#3-connections)

- **Connection Model**: The package utilizes a `Connection` model to represent the relationships between different models. Each connection has a type, source model, and target model.

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

[](#installation)

To get started with the Laravel Connective package, follow these installation steps:

1. Install the package using Composer:

```
composer require aurorawebsoftware/connective
```

2. Publish the package configuration file:

```
php artisan vendor:publish --tag=connective-config
```

3. Update the connection types in the configuration file according to your needs.

```
// config/connective.php
return [
    'connection_types' => ['friendship', 'ownership', 'parentage'],
];
```

Usage
-----

[](#usage)

### Creating a *Connective* Model

[](#creating-a-connective-model)

To work with the Laravel Connective package, ensure that your models are set up correctly. Below are examples of how to create the necessary Eloquent models for the package:

Ensure that your models extend the appropriate Eloquent classes and implement the ConnectiveContract where necessary. Customize the models according to your application's requirements and business logic.

Here is the sample models

```
use AuroraWebSoftware\Connective\Contracts\ConnectiveContract;
use AuroraWebSoftware\Connective\Models\Connection;
use AuroraWebSoftware\Connective\Traits\Connective;

class User extends Model implements ConnectiveContract
{
    use Connective

    public static function supportedConnectionTypes(): array
    {
        return ['friendship', 'parentage'];
    }

    // implementation of the model
}
```

```
use AuroraWebSoftware\Connective\Contracts\ConnectiveContract;
use AuroraWebSoftware\Connective\Models\Connection;
use AuroraWebSoftware\Connective\Traits\Connective;

class Address extends Model implements ConnectiveContract
{
    use Connective

    public static function supportedConnectionTypes(): array
    {
        return ['home', 'office'];
    }

    // implementation of the model
}
```

### Establishing Connections between Models

[](#establishing-connections-between-models)

To establish a connection between two models, you can use the `connectTo` method:

```
$sourceModel->connectTo($targetModel, 'connection_type');
```

connect user1 to user2 with friendship (make friend1 and firend2 be friend)

> Connections are unidirectional; it is necessary to establish connections from each model if required.

```
$user1->connectTo($user2, 'friendship');
$user2->connectTo($user1, 'friendship');
```

> Models can support multiple connection types and can accommodate multiple connections for the same model type.

```
$user1->connectTo($address1, 'home');
$user1->connectTo($address2, 'office');
$user1->connectTo($address3, 'office');
```

### Retrieving Connections

[](#retrieving-connections)

You can retrieve connections for a model using the `connections` method. You can filter by connection type and target model type:

```
$connections = $user1->connections('friendship');

// Retrieve all connections for the user
$connections = $user->connections();
// $connections is a collection of Connection models
```

### Retrieving Connected Models

[](#retrieving-connected-models)

To retrieve connected models (connective models) for a source model, you can use the `connectives` method. You can filter by connection type and target model type:

```
$connectiveModels = $sourceModel->connectives('connection_type', 'target_model_type');
```

Retrieve friends of the user

```
$friends = $user->connectives('friend');
```

// Retrieve residences and offices of the user

```
$residences = $user->connectives(['residence', 'office'], Address::class);
// $residences is a collection of Address models (residences and offices addresses of the user)
```

### Nested Connections

[](#nested-connections)

The package allows you to establish nested connections. For example, if Model A is connected to Model B, and Model B is connected to Model C, you can retrieve Model C from Model A through the `connectives` method.

```
$user = User::find(1);

// Retrieve friends of friends (nested connections)
$friendsOfFriends = $user->connectives('friend')->connectives('friend');

// $friendsOfFriends is a collection of User models (friends of friends)
```

```
$user = User::find(1);

// Retrieve office addresses of friends (nested connections)
$officesOfFriends = $user->connectives('friend')->connectives('office', Address::class);
```

unlimited nesting

```
$user = User::find(1);

// Retrieve a more complex nested connection
$complexNestedConnections = $user->connectives('friend')->connectives('residence')->connectives('collaborator');

// $complexNestedConnections is a collection of models based on the specified nested connections
```

Conclusion
----------

[](#conclusion)

The Laravel Connective package simplifies managing relationships between Eloquent models by providing a straightforward and customizable solution. Explore the package's capabilities and tailor them to your project's needs.

---

This is a basic structure for your Laravel Connective package documentation. Be sure to expand and customize it further based on your package's specific features and requirements. Make sure to replace placeholder URLs and descriptions with actual content related to your package.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance76

Regular maintenance activity

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 78.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 ~90 days

Recently: every ~170 days

Total

10

Last Release

130d ago

Major Versions

1.0.6 → 11.0.02024-12-11

11.0.1 → 12.0.02026-01-08

PHP version history (2 changes)1.0.0PHP ^8.2

11.0.0PHP ^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/e79935c219efe1a3132a4c9f2b87da38268fccacfcb43c453275ceafdd1ed23f?d=identicon)[emreakay](/maintainers/emreakay)

---

Top Contributors

[![emreakay](https://avatars.githubusercontent.com/u/794216?v=4)](https://github.com/emreakay "emreakay (15 commits)")[![akiftezcan38](https://avatars.githubusercontent.com/u/77398471?v=4)](https://github.com/akiftezcan38 "akiftezcan38 (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelAuroraWebSoftwareconnective

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/aurorawebsoftware-connective/health.svg)

```
[![Health](https://phpackages.com/badges/aurorawebsoftware-connective/health.svg)](https://phpackages.com/packages/aurorawebsoftware-connective)
```

###  Alternatives

[mozex/laravel-scout-bulk-actions

A Laravel Scout extension for bulk importing and flushing of all models.

1033.4k](/packages/mozex-laravel-scout-bulk-actions)[aurorawebsoftware/arflow

ArFlow is a Laravel package that allows you to implement workflow management for your Laravel Eloquent models.

233.0k2](/packages/aurorawebsoftware-arflow)[aurorawebsoftware/acalendar

This is my package acalendar

241.0k2](/packages/aurorawebsoftware-acalendar)

PHPackages © 2026

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