PHPackages                             nourayman/search-json - 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. [Search &amp; Filtering](/categories/search)
4. /
5. nourayman/search-json

ActiveLibrary[Search &amp; Filtering](/categories/search)

nourayman/search-json
=====================

Search JSON columns with Arabic character normalization

v1.0.0(1y ago)21.3k1MITPHPPHP &gt;=7.4

Since Oct 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/NourhanAymanElstohy/search-json)[ Packagist](https://packagist.org/packages/nourayman/search-json)[ RSS](/packages/nourayman-search-json/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

SearchJson Laravel Package
==========================

[](#searchjson-laravel-package)

Overview
--------

[](#overview)

The `SearchJson` package provides robust search functionality for JSON fields within a Laravel application. It allows you to search for terms in multiple languages across different JSON fields, while also supporting flexible regex patterns to handle Arabic character variations.

Features
--------

[](#features)

- Search within JSON fields across multiple languages (e.g., `ar`, `en`).
- Supports character normalization for Arabic, so variations of characters like `ا`, `أ`, `إ`, and `آ` are all matched.

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

[](#installation)

To install the SearchJson package, simply run the following command:

```
composer require nourayman/search-json
```

Usage
-----

[](#usage)

1. **Add Searchable Trait to your Model**

In your Model, Add trait`Searhable` to Article Model:

```
use Nourayman\SearchJson\Searchable;
class Article {
    use Searchable;
    // Your Model Code
}
```

In your Controller, use the function `searchJson` directly:

```
$field = 'title';
$langs = ['ar', 'en'];
$text = 'ألنفسيه';

$results = Article::searchJson($field, $text, $langs);
```

2. **Customizing Character Variations**

The package automatically handles Arabic character normalization. You can further customize this by modifying the `buildRegexPattern` method in the service class to add new character variations or optional prefixes as needed.

Methods
-------

[](#methods)

### `searchJson($field, $term, array $langs)`

[](#searchjsonfield-term-array-langs)

- **Description**: Searches through specified JSON fields in multiple languages, handling variations in Arabic characters.
- **Parameters**:
    - `$field`: THe JSON field to search within (e.g., `title`).
    - `$term`: The search term, which can include any form of Arabic characters.
    - `$langs`: Languages to search within the JSON fields (e.g., `['ar', 'en']`).
- **Returns**: Collection of matched results.

Example Query
-------------

[](#example-query)

For a given term like `'ألنفسيه'`, the package will match:

- `النفسية`
- `ألنفسية`
- `إلنفسية`
- `النفسيه`
- `ألنفسيه`
- `إلنفسية`

This search flexibility is ideal for applications needing robust multi-language support in JSON fields.

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

[](#contributing)

Contributions are welcome! If you have any bug reports, feature requests, or pull requests, please submit them to the [GitHub repository](https://github.com/nourayman/searchjson).

License
-------

[](#license)

This package is open-sourced software licensed under the MIT license.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

628d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25115879?v=4)[Nourhan Ayman ](/maintainers/NourhanAymanElstohy)[@NourhanAymanElstohy](https://github.com/NourhanAymanElstohy)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nourayman-search-json/health.svg)

```
[![Health](https://phpackages.com/badges/nourayman-search-json/health.svg)](https://phpackages.com/packages/nourayman-search-json)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)

PHPackages © 2026

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