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 today

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 22% 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

2317d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a8412a4c8245265717b9225c09cc4609e4c545732dc20e102139db6e6836c2a?d=identicon)[luis199230](/maintainers/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

[jedrzej/searchable

Searchable trait for Laravel's Eloquent models - filter your models using request parameters

127259.1k5](/packages/jedrzej-searchable)[jedrzej/sortable

Sortable trait for Laravel's Eloquent models - sort your models using request parameters

54261.0k1](/packages/jedrzej-sortable)[jedrzej/withable

Withable trait for Laravel's Eloquent models

25193.2k2](/packages/jedrzej-withable)[matthenning/eloquent-api-filter

Awesome and simple way to filter Eloquent queries right from the API URL without the clutter.

104.9k](/packages/matthenning-eloquent-api-filter)

PHPackages © 2026

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