PHPackages                             mrlijan/restmold - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. mrlijan/restmold

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mrlijan/restmold
================

Restmold, Model-based HTTP client for Laravel applications.

1.0.0(3y ago)54MITPHPPHP ^7.4|^8.0

Since Sep 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/MrLijan/Restmold)[ Packagist](https://packagist.org/packages/mrlijan/restmold)[ RSS](/packages/mrlijan-restmold/feed)WikiDiscussions 1.x Synced 1mo ago

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

Introduction
============

[](#introduction)

Restmold (pronounced /restː/ /mold:/) is a Laravel package for modeling 3rd party HTTP services and as an HTTP client. Using this package will allow you to model your external HTTP services. The magic behind Restmold is that you don't need to repeatedly re-code your API class services.

### Inspiration

[](#inspiration)

The inspiration for this project started when the company I worked for migrated our giant monolith into a bunch of small microservices. Time passed, and we found ourselves writing API services repeatedly as the number of services grew. So, inspired by the flow of Laravel's models, Restmold has born out.

> ⚠️ The package supports Laravel 7 and above.

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

[](#installation)

```
composer require mrlijan/restmold

```

Usage
-----

[](#usage)

Restmold is so easy-to-use; you just need to run the generate command to create a new API model. As a result, a new folder named "ApiModels" will be created under the `\App` folder, including the new concrete class.

```
php artisan restmold:generate

```

Class Structure
===============

[](#class-structure)

Each restmold concrete class will derive its props and methods from the `RestModel` abstract class and should also implement the following properties and methods to work properly:

TypeNameDescriptionProperty**baseURI**The base uri for that specific serviceMethod**headers**Return the request's headers. This can be used for authenticationMethod**routes**Used to construct the service's structureClass Configuration
===================

[](#class-configuration)

the routes method is being used to construct the service's structure. This means that every array index listed below will be determined as a method for this service.

Each index of that array will be constructed as follows:

```
protected function routes(): array
{
    return [
        'methodName' => [
            'method' => 'GET', // The reuqest's method
            'path' => '/index' // The reuqest's endpoint
        ],
    ];
}
```

### Config with Query Params

[](#config-with-query-params)

Your route includes query params? We've got your back! Just use the regular syntax, excluding the values. For example:

```
protected function routes(): array
{
    return [
        'list' => [
            'method' => 'GET',
            'path' => '/students?name&age'
        ],
    ];
}
```

Implementations
===============

[](#implementations)

### Using Query Params

[](#using-query-params)

Once everything is ready and configured, the service is prepared to use.

```
use App\ApiModels\StudentsAPIModel;

class StudentsController extends BaseController
{
    public function listByParams(StudentsAPIModel $students_api)
    {
        return $students_api->list([
            'query' => [
                'name' => 'Brendon',
                'age' => '22'
            ]
        ]);
    }
}
```

### Using request body

[](#using-request-body)

```
use App\ApiModels\StudentsAPIModel;

class StudentsController extends BaseController
{
    public function createNewStudent(StudentsAPIModel $students_api)
    {
        return $students_api->create([
            'body' => [
                'firstName' => 'John',
                'lastName' => 'Dow'
                'age' => '24',
                'email' => 'john.d@example.com'
            ]
        ]);
    }
}
```

Piping Requests &amp; Responses
===============================

[](#piping-requests--responses)

Sometimes, collective pipes are necessary in some services, and for these cases, a request and response pipes have been created. In order to use them just override the following methods:

```
protected function requestPipe(Request $request): Request
{
    // ... manipulate the data, and return the request
    return $request;
}

protected function responsePipe(Response $response): Response
{
    // ... manipulate the data, and return the response
    return $response;
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~14 days

Total

2

Last Release

1318d ago

### Community

Maintainers

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

---

Top Contributors

[![MrLijan](https://avatars.githubusercontent.com/u/50079872?v=4)](https://github.com/MrLijan "MrLijan (31 commits)")

---

Tags

apiapi-clientguzzleguzzlehttplaravelmodelphphttphttpsapilaravelGuzzle

### Embed Badge

![Health badge](/badges/mrlijan-restmold/health.svg)

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

###  Alternatives

[e-moe/guzzle6-bundle

Integrates Guzzle 6 into your Symfony application

11259.2k](/packages/e-moe-guzzle6-bundle)[remic/guzzlecache

Laravel 5 package for caching Guzzle's GET requests.

189.3k](/packages/remic-guzzlecache)[laragear/api-manager

Manage multiple REST servers to make requests in few lines and fluently.

161.8k](/packages/laragear-api-manager)[behamin/service-proxy

for proxy or sending requests to other services with useful utilities

102.2k](/packages/behamin-service-proxy)

PHPackages © 2026

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