PHPackages                             jpbassalot/jsonapi - 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. [API Development](/categories/api)
4. /
5. jpbassalot/jsonapi

ActiveLibrary[API Development](/categories/api)

jpbassalot/jsonapi
==================

A simple JSON API to read and paginate JSON files in a directory

v1.0.0(3y ago)011MITPHPPHP ^8.1

Since Apr 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jpbassalot/jsonapi)[ Packagist](https://packagist.org/packages/jpbassalot/jsonapi)[ RSS](/packages/jpbassalot-jsonapi/feed)WikiDiscussions main Synced today

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

JSON File API
=============

[](#json-file-api)

The JSON File API is a simple read-only API that allows you to fetch and serialize data stored in JSON files. This API supports pagination and searching for files based on specific properties.

Getting Started
---------------

[](#getting-started)

To use this, you will need to have PHP &gt;= 8.1 installed.

Usage
-----

[](#usage)

### Fetching with Pagination

[](#fetching-with-pagination)

Example: `GET /path/to/index.php?page=1`

Query Parameters:

- `page` (optional): The page number to fetch. If not provided, it defaults to 1.

### Searching within JSON properties

[](#searching-within-json-properties)

To search within specific properties, make a GET request with the search query parameter.

Example: `GET /path/to/index.php?search=data`

Query Parameters:

- `search` (optional): The search query to filter files.

Example Usage
-------------

[](#example-usage)

```
require_once 'vendor/autoload.php';

use Jpbassalot\JsonApi;

// A directory containing JSON files
$dir = 'json';

$reports = new JsonApi($dir, 9);

$all_files = $reports->getFiles();

$search = isset($_GET['search']) ? htmlspecialchars($_GET['search'], ENT_QUOTES, 'UTF-8') : '';

/**
* JSON Example:
 * {
 *  "title": "My Title",
 *  "property1": "Property 1",
 *  "property2": "Property 2",
 *  "property3": "Property 3",
 *  "nested": {
 *      "property1": "Nested Property 1",
 *      "property2": "Nested Property 2"
 * }
 */
if ($search) {
    $result = $reports->searchFilesData($search, ['title', 'property1', 'property2', 'property3', 'nested.property1', 'nested.property2'], $all_files);
} else {
    $result = $reports->getFilesData($all_files);
}

echo $reports->sendJson($result, $all_files);
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

1186d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e804535f9b97d29a8c6080562d6a64ac7ab345d06a580c7f557bc82011c83f1?d=identicon)[jpbassalot](/maintainers/jpbassalot)

---

Top Contributors

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

---

Tags

jsonapijsonapiJSON-API

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jpbassalot-jsonapi/health.svg)

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

###  Alternatives

[neomerx/json-api

Framework agnostic JSON API (jsonapi.org) implementation

7433.7M30](/packages/neomerx-json-api)[cloudcreativity/laravel-json-api

JSON API (jsonapi.org) support for Laravel applications.

7851.1M4](/packages/cloudcreativity-laravel-json-api)[alsvanzelf/jsonapi

Human-friendly library to implement JSON:API without needing to know the specification.

55158.2k6](/packages/alsvanzelf-jsonapi)[cloudcreativity/json-api-testing

PHPUnit test helpers to check JSON API documents.

141.7M4](/packages/cloudcreativity-json-api-testing)[nilportugues/laravel5-json-api

Laravel 5 JSON API Transformer Package

31232.5k1](/packages/nilportugues-laravel5-json-api)[nilportugues/jsonapi-bundle

Symfony 2 &amp; 3 JSON API Transformer Package

11446.7k](/packages/nilportugues-jsonapi-bundle)

PHPackages © 2026

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