PHPackages                             happynessarl/caching-management - 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. happynessarl/caching-management

ActiveLibrary

happynessarl/caching-management
===============================

Data caching system with integrated CRUD

1.2.3(1y ago)194MITPHPPHP ^8.1|^8.2|^8.3

Since Jul 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Frederick-Dikaprio/Cache-management)[ Packagist](https://packagist.org/packages/happynessarl/caching-management)[ RSS](/packages/happynessarl-caching-management/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Happynessarl Cache Management
=============================

[](#happynessarl-cache-management)

-&gt; This package lets you manage the cache with Laravel. You can choose to use Redis or the file system as your cache manager. On top of that, it contains an integrated CRUD system where the cache handles everything. All you have to do is pass the model, and you're done.

-&gt; I give you this with a pagination tool too, which is very handy, for paginating data coming from the cache or data arrays

-&gt; This package also offers you a quick and efficient way of managing relationships, but you need to specify them each time in your data responses. All you have to do is add an element to each of your models, and you're done!

install via composer in laravel
-------------------------------

[](#install-via-composer-in-laravel)

`composer require happynessarl/caching-management`

First To do this, in your service class, which could be :

I- import this `BaseModel` trait into all your Laravel models in order to manage all caches, as they are managed by models
--------------------------------------------------------------------------------------------------------------------------

[](#i--import-this-basemodel-trait-into-all-your-laravel-models-in-order-to-manage-all-caches-as-they-are-managed-by-models)

Classe UserService
------------------

[](#classe-userservice)

```
use Happynessarl\Caching\Management\Services\BaseService;
use Illuminate\Pagination\LengthAwarePaginator;
use Happynessarl\Caching\Management\Services\Contracts;

class UserService extends BaseService implements IBaseService
{
    private function initializeModel(): void
    {
        $this->setModel(new User());
    }

    /**
     * you need to implement it in your service to initialize Model Object
     *
     * @inheritDoc
     */
    protected function getModelObject(): User
    {
        $this->initializeModel();
        return $this->getModel();
    }

    /**
     * To paginate, proceed as follows
     */
    public function getAllUsers(): LengthAwarePaginator
    {
        /** Call this method when you want to fetch all the data in a Table, similar to what Laravel offers: Employee::all(); instead, use this method */
        $items = $this->cacheAllRecords();

        /** Call this method and your data will be paginated, $items = collection or array, and 9 is a perPage that you want to paginate */
        $paginator = $this->paginateModelCollection($items, 9);

        return $paginator;
    }

    // your another methods here
}
```

II- To manage relationships automatically without having to specify them on each data return, add this variable to each of your Models like this
------------------------------------------------------------------------------------------------------------------------------------------------

[](#ii--to-manage-relationships-automatically-without-having-to-specify-them-on-each-data-return-add-this-variable-to-each-of-your-models-like-this)

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Client extends Model
{
    use  BaseModel; //Same to this BaseModelTrait

    protected $fillable = ['user_id', 'address', 'phone'];

    /** Here's the this to add to all your models, specifying the relationships inside.  */
    protected $cacheableRelations = ['user', 'orders'];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function orders()
    {
        return $this->hasMany(Order::class);
    }
}
```

For example:

1) to add data to the database, you'll use
------------------------------------------

[](#1-to-add-data-to-the-database-youll-use)

```
 $result = $this->insert($modelData);

```

2) for update it will be :
--------------------------

[](#2-for-update-it-will-be-)

```
 $result = $this->update($modelData);

```

3) for delete it will be a void :
---------------------------------

[](#3-for-delete-it-will-be-a-void-)

```
$this->delete($modelData);

```

4) for search, there are several types:
---------------------------------------

[](#4-for-search-there-are-several-types)

```
$result = $this->findModelBy($key, $value); return Model
$result = $this->findModelById($id); return Model
$result = $this->findUserByUuid($user_uuid); return Model
$result = $this->getModelCollection($key, $value); return COllection

```

and all return model data

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

3

Last Release

621d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90cb10af9de969e2f2527cc268ad88e9da13fe1386549b1ddda145eceeab1681?d=identicon)[Lelouch](/maintainers/Lelouch)

---

Top Contributors

[![Frederick-Dikaprio](https://avatars.githubusercontent.com/u/80330918?v=4)](https://github.com/Frederick-Dikaprio "Frederick-Dikaprio (26 commits)")

### Embed Badge

![Health badge](/badges/happynessarl-caching-management/health.svg)

```
[![Health](https://phpackages.com/badges/happynessarl-caching-management/health.svg)](https://phpackages.com/packages/happynessarl-caching-management)
```

PHPackages © 2026

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