PHPackages                             madeweb/eloquent-api - 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. [Database &amp; ORM](/categories/database)
4. /
5. madeweb/eloquent-api

ActiveLibrary[Database &amp; ORM](/categories/database)

madeweb/eloquent-api
====================

An Eloquent model with support for API, is a wrapper for use endpoints how to model entities

v0.1(6y ago)010GPL-3.0-onlyPHP

Since Jan 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/luis199230/Eloquent-for-API)[ Packagist](https://packagist.org/packages/madeweb/eloquent-api)[ RSS](/packages/madeweb-eloquent-api/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Eloquent-for-API
================

[](#eloquent-for-api)

[![Packagist](https://camo.githubusercontent.com/40d1734a01b551cd78912f8ef62a7caf4d416bbd84971fd40f818e0e068ed49d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6c7569733139393233302f656c6f7175656e742d666f722d6170693f7374796c653d706c6173746963)](https://camo.githubusercontent.com/40d1734a01b551cd78912f8ef62a7caf4d416bbd84971fd40f818e0e068ed49d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6c7569733139393233302f656c6f7175656e742d666f722d6170693f7374796c653d706c6173746963)[![GitHub stars](https://camo.githubusercontent.com/5dbc34c6de0aaf499bc523878715832787dbae78903b0bd8e875856e4d9f1544/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6c7569733139393233302f656c6f7175656e742d666f722d6170693f7374796c653d706c6173746963)](https://camo.githubusercontent.com/5dbc34c6de0aaf499bc523878715832787dbae78903b0bd8e875856e4d9f1544/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6c7569733139393233302f656c6f7175656e742d666f722d6170693f7374796c653d706c6173746963)

This package allow use models and relationships using resources of API how to entities.

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

[](#installation)

```
composer require madeweb/eloquent-api
```

Generate model wrapper for call to api

```
php artisan make:model-api Model --api=API\\NameOfAPI
```

Generate model wrapper for authentication with passport

```
php artisan make:model-api Model --api=API\\NameOfAPI --auth
```

Configure
---------

[](#configure)

#### Use fillable in models

[](#use-fillable-in-models)

Is very important setup the fillable because this variable allow recognize the fields will have your model.

```
    protected $fillable = ['uuid', 'name', 'last_name', 'phone', 'document_type', 'document_number',
        'birthdate', 'civil_status', 'gender', 'address_uuid', 'user_uuid'];
```

#### Relationships

[](#relationships)

For prepare relations between model is required use this syntax. For example for the person model the order of parameters is class belongs, key for identify relationship, common key or field in both models, and method of API for connecting.

```
    public function user()
    {
        return $this->relationship(User::class, 'user', $this->user_uuid, 'find');
    }
```

#### Methods Basics

[](#methods-basics)

How it is an api, it is necessary to define own functions to call basic methods that exist in eloquent. For example, in this function, the showPerson method must exist in the API.

```
    public function find($uuid)
    {
        $response = $this->connection->showPerson($uuid);
        return $this->prepareResponse($response);
    }
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

2371d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3792898?v=4)[Luis Benavides](/maintainers/luis199230)[@luis199230](https://github.com/luis199230)

---

Top Contributors

[![luis199230](https://avatars.githubusercontent.com/u/3792898?v=4)](https://github.com/luis199230 "luis199230 (7 commits)")

---

Tags

eloquenteloquent-apilaravelmicroservicesapieloquentmicroservices

### Embed Badge

![Health badge](/badges/madeweb-eloquent-api/health.svg)

```
[![Health](https://phpackages.com/badges/madeweb-eloquent-api/health.svg)](https://phpackages.com/packages/madeweb-eloquent-api)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[jedrzej/withable

Withable trait for Laravel's Eloquent models

25203.4k2](/packages/jedrzej-withable)[ghostcompiler/laravel-querybuilder

Reusable query builder helpers for Eloquent APIs on Laravel 10 through 13.

172.3k](/packages/ghostcompiler-laravel-querybuilder)

PHPackages © 2026

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