PHPackages                             avertys/lighter - 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. avertys/lighter

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

avertys/lighter
===============

Make your requests lighter

1.0.3(5y ago)08MITPHPPHP &gt;=7.0.0

Since Dec 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/steveaverty/Laravel-Lighter)[ Packagist](https://packagist.org/packages/avertys/lighter)[ Docs](https://github.com/steveaverty/Laravel-Lighter)[ RSS](/packages/avertys-lighter/feed)WikiDiscussions master Synced 1mo ago

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

LIGHTER
=======

[](#lighter)

Lighter is a package htaht help you improve performances of your request. You can specify which data you want to keep in your model or let the client request what he wants.

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

[](#installation)

In order to install Lighter, just use compose:

```
composer require "avertys/lighter"
```

How to use Lighter
------------------

[](#how-to-use-lighter)

### On model

[](#on-model)

To use lighter on your model you have to add Avertys\\Lighter\\LighterTrait to your model

```
class User extends Model
{
    use LighterTrait;

    protected $appends = ['fullname'];
}
```

Then, you just have to write the followinf code. In this example, accessors are not calculated.

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

return response()->json(
    $user->lighter()->keep(['name', 'address']);
, 200);

/*
{
    "name" : "Steve",
    "age" : "28"
}
*/
```

You also can use lighter on collection with the helper.

```
$users = User::all();

return response()->json(
    lighter($users)->keep(['name', 'address']);
, 200);

/*
{
    "name" : "Steve",
    "age" : "28"
},
{
    "name" : "John",
    "age" : "35"
},
*/
```

Helper can be use on model

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

return response()->json(
    lighter($user)->keep(['name', 'address']);
, 200);

/*
{
    "name" : "Steve",
    "age" : "28"
},
{
    "name" : "John",
    "age" : "35"
},
*/
```

Using the request : Let your client request what he needs.

In the params, add as \_keep parameter `http://localhost/users?_keep["name"]` .

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

return response()->json(
    lighter($user)->keep();
, 200);

/*
{
    "name" : "Steve",
    "age" : "28"
},
{
    "name" : "John",
    "age" : "35"
},
*/
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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 ~0 days

Total

4

Last Release

1980d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

1.0.1PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0585175e98333f2a881690b935f6fd42813cfdf2e5820c092ae77d08c6f17e45?d=identicon)[steveaverty](/maintainers/steveaverty)

---

Top Contributors

[![steveaverty](https://avatars.githubusercontent.com/u/76013056?v=4)](https://github.com/steveaverty "steveaverty (8 commits)")

---

Tags

requestlaravellighter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/avertys-lighter/health.svg)

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

###  Alternatives

[chelout/laravel-http-logger

A Laravel package to log HTTP requests, headers and sessions

272.0k](/packages/chelout-laravel-http-logger)[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)
