PHPackages                             omarsaiouf/integrations - 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. omarsaiouf/integrations

ActiveLibrary

omarsaiouf/integrations
=======================

dynamic integartions for APIs

1.0.0(3mo ago)130↓50%MITPHPPHP ^8.1|^8.2

Since Feb 2Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/OmarSaiouf/laravel-dynamic-integrations)[ Packagist](https://packagist.org/packages/omarsaiouf/integrations)[ RSS](/packages/omarsaiouf-integrations/feed)WikiDiscussions main Synced 1mo ago

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

laravel-dynamic-integrations
============================

[](#laravel-dynamic-integrations)

Dynamic, configuration-driven API integrations for Laravel. Define providers, endpoints, auth, and response mapping in config (or database/file) and run them with a single call.

[Arabic documentation](docs/README.ar.md)

Overview
--------

[](#overview)

This package lets you define external API integrations declaratively and execute them with a single call. You can store rules in config (ARRAY), JSON file (FILE), or database (DATABASE).

Features
--------

[](#features)

- Provider + endpoint definitions (array, file, or database-backed)
- Auth helpers (none, bearer token, api key, basic)
- Mapping DSL with `@each` support
- Run logging with Eloquent
- Parallel execution via `pool`

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

[](#installation)

```
composer require omarsaiouf/integrations
```

Publish config and demo files
-----------------------------

[](#publish-config-and-demo-files)

```
php artisan vendor:publish --tag=integrations-config
php artisan vendor:publish --tag=integrations-publishes
```

Quick start
-----------

[](#quick-start)

```
use Omarsaiouf\Integrations\Facades\Integration;

$result = Integration::run('jsonplaceholder', 'list_posts', [
    'userId' => 1,
]);
```

Configuration
-------------

[](#configuration)

### Base config

[](#base-config)

File: `config/integrations/base.php`

Key options:

- `type`: ARRAY | FILE | DATABASE
- `file_path`: JSON rules file path (for FILE)
- `http`: provider, timeout, retry
- `mapper`: mapper name
- `logging`: store response body and raw limits

Example:

```
return [
    'type' => Type::ARRAY,
    'file_path' => storage_path('rules.json'),
    'http' => [
        'provider' => 'Http',
        'timeout' => 20,
        'retry' => ['times' => 2, 'sleep_ms' => 300],
    ],
    'mapper' => ['name' => 'default'],
    'logging' => ['store_response_body' => true, 'max_raw_length' => 1000],
];
```

### Rules (ARRAY mode)

[](#rules-array-mode)

File: `config/integrations/rules.php`

#### Providers

[](#providers)

Each provider defines base URL and auth details.

```
'providers' => [
    'github' => [
        'url' => 'https://api.github.com',
        'auth_type' => AuthType::BEARER_TOKEN,
        'auth_meta' => ['token' => env('GITHUB_TOKEN')],
    ],
],
```

#### Endpoints

[](#endpoints)

Each endpoint defines method/path, optional headers/query/body, and mapping.

```
'endpoints' => [
    'get_repo' => [
        'method' => HttpMethod::GET,
        'path' => '/repos/{owner}/{repo}',
        'headers' => ['Accept' => 'application/json'],
        'query' => ['per_page' => 50],
        'mapping' => [
            'rules' => [
                'id' => 'id',
                'full_name' => 'full_name',
                'owner' => ['login' => 'owner.login'],
            ],
        ],
    ],
],
```

### Rules JSON (FILE mode)

[](#rules-json-file-mode)

File: `storage/rules.json` (or custom path)

```
{
  "providers": {
    "demo": {
      "url": "https://api.example.com",
      "auth_type": "api_key",
      "auth_meta": { "name": "X-API-KEY", "value": "...", "in": "header" }
    }
  },
  "endpoints": {
    "list_items": {
      "method": "GET",
      "path": "/items",
      "mapping": { "rules": { "@each": ".", "map": { "id": "id" } } }
    }
  }
}
```

### Database (DATABASE mode)

[](#database-database-mode)

Migrations are included. Tables:

- Providers: base URL and auth metadata
- Endpoints: method/path/headers/query/body
- Mappings: JSON rules used by mapper

Mapping rules (DSL)
-------------------

[](#mapping-rules-dsl)

- String value =&gt; dot path (e.g. `user.id`)
- Scalar value =&gt; constant
- Array/object =&gt; recursive mapping
- `@each` + `map` =&gt; map lists

Example:

```
'rules' => [
    '@each' => 'data.items',
    'map' => [
        'id' => 'id',
        'title' => 'title',
        'author' => ['name' => 'user.name'],
    ],
],
```

### Array mapping example

[](#array-mapping-example)

When the response is an array of items:

```
'rules' => [
    '@each' => '.',
    'map' => [
        'id' => 'id',
        'name' => 'title',
        'content' => 'body',
    ],
],
```

### Single object mapping example

[](#single-object-mapping-example)

When the response is a single object:

```
'rules' => [
    'id' => 'id',
    'name' => 'title',
    'content' => 'body',
],
```

Auth types
----------

[](#auth-types)

Supported:

- `NONE`
- `BEARER_TOKEN` (token or auth\_meta.token)
- `API_KEY` (auth\_meta: name, value, in)
- `BASIC` (auth\_meta: username, password)

Running integrations
--------------------

[](#running-integrations)

```
$result = Integration::run('provider_key', 'endpoint_key', [
    'userId' => 1,
]);
```

Parallel execution (pool)
-------------------------

[](#parallel-execution-pool)

```
use Omarsaiouf\Integrations\Integration\IntegrationManager;

$result = Integration::pool([
    'list_posts' => [
        'provider' => 'jsonplaceholder',
        'endpoint' => 'list_posts',
        'inputs' => ['userId' => 1],
    ],
    'get_post' => [
        'provider' => 'jsonplaceholder',
        'endpoint' => 'get_post',
        'inputs' => ['postId' => 2],
    ],
]);
```

Logging
-------

[](#logging)

The default logger stores each run (success/failure) with request/response snapshots. Sensitive headers are redacted.

Testing
-------

[](#testing)

```
composer update
vendor/bin/phpunit
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance80

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

105d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/808ab0e8cffb11e49a256886b064d67cc6ac7d8dc28de83ee2a5c7cbf6c312e3?d=identicon)[omarsaiouf](/maintainers/omarsaiouf)

---

Top Contributors

[![OmarSaiouf](https://avatars.githubusercontent.com/u/182301060?v=4)](https://github.com/OmarSaiouf "OmarSaiouf (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/omarsaiouf-integrations/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11120.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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