PHPackages                             towoju5/smart-meta-manager - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. towoju5/smart-meta-manager

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

towoju5/smart-meta-manager
==========================

Simple smart meta manage for laravel/middey Technology

v1.1.0(1y ago)117MITPHPPHP ^7.4|^8.0

Since Sep 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/towoju5/smart-meta-manager)[ Packagist](https://packagist.org/packages/towoju5/smart-meta-manager)[ Docs]()[ RSS](/packages/towoju5-smart-meta-manager/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (5)Used By (0)

Nellalink SmartMetaManager
==========================

[](#nellalink-smartmetamanager)

Nellalink SmartMetaManager is a powerful Laravel package designed to simplify the management of metadata for your models. It provides a flexible and efficient way to associate additional information with your model instances, allowing for dynamic and extensible data storage without altering your database schema.

[![Latest Version on Packagist](https://camo.githubusercontent.com/8a2ad389c8b951fa97bbca23716484172b8056abb0ca81bace481f7faa724206/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f776f6a75352f736d6172742d6d6574612d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/towoju5/smart-meta-manager)[![Total Downloads](https://camo.githubusercontent.com/c83250dac30850adc4f83061180e9db092aaf1dcfcc1e4556622b8976e56fbd0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f776f6a75352f736d6172742d6d6574612d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/towoju5/smart-meta-manager)[![GitHub Actions](https://github.com/towoju5/smart-meta-manager/actions/workflows/main.yml/badge.svg)](https://github.com/towoju5/smart-meta-manager/actions/workflows/main.yml/badge.svg)

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Model Setup](#model-setup)
    - [API Endpoints](#api-endpoints)
    - [Authentication](#authentication)
- [MetaDataTrait](#metadatatrait)
- [SmartMetaManager Controller](#smartmetamanager-controller)
- [API Usage Examples](#api-usage-examples)
- [Error Handling](#error-handling)
- [Best Practices](#best-practices)
- [Performance Considerations](#performance-considerations)
- [Security](#security)
- [Extending Nellalink SmartMetaManager](#extending-nellalink-smartmetamanager)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

You can install the package via composer:

composer require towoju5/smart-meta-manager

After installation, publish the configuration file:

php artisan vendor:publish --tag=smart-meta-manager-config

Configuration
-------------

[](#configuration)

The configuration file `config/meta_models.php` allows you to specify which models can have associated metadata and set the authentication guard:

return \[ 'meta\_data\_models' =&gt; \[ 'user' =&gt; App\\Models\\User::class, 'product' =&gt; App\\Models\\Product::class, // Add more models as needed \], 'auth\_guard' =&gt; 'api', \];

Usage
-----

[](#usage)

### Model Setup

[](#model-setup)

To enable metadata functionality for a model, use the MetaDataTrait:

```
use Towoju5\SmartMetaManager\Trait\MetaDataTrait;

class User extends Model
{
    use MetaDataTrait;
    // ... other model code
}

```

README documentation on how to access the traits from the models:

Accessing Traits in Models
==========================

[](#accessing-traits-in-models)

This guide explains how to use the MetaDataTrait in your models to manage metadata.

Setup
-----

[](#setup)

1. Import the MetaDataTrait at the top of your model file:

```
use Towoju5\SmartMetaManager\Trait\MetaDataTrait;

```

2. Use the trait in your model:

```
class YourModel extends Model
{
    use MetaDataTrait;

    // ...
}

```

Usage
-----

[](#usage-1)

Once the trait is included in your model, you can use the following methods:

### Setting Metadata

[](#setting-metadata)

```
$model->setMeta('key', 'value');

```

### Getting Metadata

[](#getting-metadata)

```
$value = $model->getMeta('key', 'default_value');

```

### Deleting Metadata

[](#deleting-metadata)

```
$model->deleteMeta('key');

```

### Getting All Metadata

[](#getting-all-metadata)

```
$allMeta = $model->getAllMeta();

```

### Searching Metadata

[](#searching-metadata)

```
$results = $model->searchMeta('search_term');

```

### Checking for Specific Metadata

[](#checking-for-specific-metadata)

```
$exists = $model->hasMetaKeyValue('key', 'value');

```

Example
-------

[](#example)

```
$user = User::find(1);
$user->setMeta('preferences', json_encode(['theme' => 'dark']));
$preferences = json_decode($user->getMeta('preferences'), true);

```

This trait provides a flexible way to add metadata to your models without modifying the database schema for each new piece of information you want to store.

### API Endpoints

[](#api-endpoints)

Nellalink SmartMetaManager provides the following API endpoints:

- GET `/api/meta/{model}` - Retrieve all meta data for a model
- POST `/api/meta/{model}` - Add new meta data
- GET `/api/meta/{model}/search` - Search meta data
- GET `/api/meta/user/all` - Retrieve all user meta data
- GET `/api/meta/{model}/{key}` - Retrieve specific meta data
- PUT `/api/meta/{model}/{key}` - Update specific meta data
- DELETE `/api/meta/{model}/{key}` - Delete specific meta data
- POST `/api/meta/{model}/check` - Check if a key-value pair exists

### Authentication

[](#authentication)

All API endpoints require authentication using the guard specified in the config file. Ensure you're authenticated before making requests.

MetaDataTrait
-------------

[](#metadatatrait)

The MetaDataTrait provides methods for interacting with metadata at the model level. Available methods include:

- `metaData()`
- `setMeta($key, $value, $userId)`
- `getMeta($key, $userId, $default = null)`
- `deleteMeta($key, $userId)`
- `getAllMetaForUser($userId)`
- `searchMeta($userId, $search)`
- `hasMetaKeyValue($key, $value, $userId)`

SmartMetaManager Controller
---------------------------

[](#smartmetamanager-controller)

The SmartMetaManager controller handles API requests for metadata operations. Controller methods include:

- `getModelMeta(Request $request, $model)`
- `getAllUserMeta(Request $request)`
- `searchMeta(Request $request, $model)`
- `setMeta(Request $request, $model)`
- `getMeta(Request $request, $model, $key)`
- `updateMeta(Request $request, $model, $key)`
- `deleteMeta(Request $request, $model, $key)`
- `checkMetaKeyValue(Request $request, $model)`

API Usage Examples
------------------

[](#api-usage-examples)

For detailed API usage examples, including requests and responses for various operations, please refer to the full documentation.

Error Handling
--------------

[](#error-handling)

Nellalink SmartMetaManager uses consistent error responses for all API endpoints. Common error scenarios include invalid model names, non-existent keys, validation errors, and authentication failures.

Best Practices
--------------

[](#best-practices)

- Use consistent and descriptive key names for your metadata
- Implement caching for frequently accessed metadata
- Use batch operations for setting or updating multiple meta values
- Regularly clean up orphaned or outdated metadata

Performance Considerations
--------------------------

[](#performance-considerations)

- Ensure proper indexing on the metadata table
- Use eager loading to avoid N+1 query problems
- Implement chunking for operations on large datasets
- Consider using Laravel's queue system for time-consuming metadata operations

Security
--------

[](#security)

- Implement proper authorization checks
- Validate and sanitize input data
- Avoid storing sensitive information as metadata
- Implement rate limiting on API endpoints

Extending Nellalink SmartMetaManager
------------------------------------

[](#extending-nellalink-smartmetamanager)

You can extend the functionality of Nellalink SmartMetaManager by adding custom scopes, utilizing Laravel's model events, implementing custom validation rules, and creating custom middleware.

Troubleshooting
---------------

[](#troubleshooting)

For common issues and their solutions, please refer to the Troubleshooting section in the full documentation.

Contributing
------------

[](#contributing)

Contributions to Nellalink SmartMetaManager are welcome! Please follow the steps outlined in the Contributing section of the full documentation.

Credits
-------

[](#credits)

- [EMMANUEL TOWOJU](https://github.com/towoju5)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Total

4

Last Release

591d ago

Major Versions

v0.1 → v1.0.12024-09-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/10d0b6560e7895f8e4b30e120cc5fca9e6a6472ce741a9c54779ba6f1ac6b158?d=identicon)[Towoju5](/maintainers/Towoju5)

---

Top Contributors

[![towoju5](https://avatars.githubusercontent.com/u/40261626?v=4)](https://github.com/towoju5 "towoju5 (15 commits)")

---

Tags

towoju5smart meta manager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/towoju5-smart-meta-manager/health.svg)

```
[![Health](https://phpackages.com/badges/towoju5-smart-meta-manager/health.svg)](https://phpackages.com/packages/towoju5-smart-meta-manager)
```

PHPackages © 2026

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