PHPackages                             okipa/laravel-model-json-storage - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. okipa/laravel-model-json-storage

AbandonedArchivedLibrary[File &amp; Storage](/categories/file-storage)

okipa/laravel-model-json-storage
================================

Storing your models in a json file rather than in database (single or few lines recording) can be a good option. This package saves you to create a table for a ridiculous amount of lines, improves the data recovery performances, and allows you to store and access to your models from a json files as you would do it in database.

1.0.4(7y ago)241.4k15[4 issues](https://github.com/Okipa/laravel-model-json-storage/issues)MITPHPPHP &gt;=7.0

Since Mar 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Okipa/laravel-model-json-storage)[ Packagist](https://packagist.org/packages/okipa/laravel-model-json-storage)[ Docs](https://github.com/Okipa/laravel-model-json-storage)[ RSS](/packages/okipa-laravel-model-json-storage/feed)WikiDiscussions master Synced today

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

laravel-model-json-storage
==========================

[](#laravel-model-json-storage)

[![Source Code](https://camo.githubusercontent.com/bfb1ee15bbb78493af79cec089dd605012cccc6a422ad282afafd6fc4e9e6bed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d6f6b6970612f6c61726176656c2d2d6d6f64656c2d2d6a736f6e2d2d73746f726167652d626c75652e737667)](https://github.com/Okipa/laravel-model-json-storage)[![Latest Version](https://camo.githubusercontent.com/cf8b2ccbeaccfe0b089830624499db35610d3cb3f28d227ac095bf3b7b474d3a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6f6b6970612f6c61726176656c2d6d6f64656c2d6a736f6e2d73746f726167652e7376673f7374796c653d666c61742d737175617265)](https://github.com/Okipa/laravel-model-json-storage/releases)[![Total Downloads](https://camo.githubusercontent.com/ec07d81b65412958f884c7c4070a7fc7b3d2d133b5542138fe11d29f63a819a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6b6970612f6c61726176656c2d6d6f64656c2d6a736f6e2d73746f726167652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/okipa/laravel-model-json-storage)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![Build Status](https://camo.githubusercontent.com/3981e59476d22137840041142c45b30c91fd83b8d48ae09b26308769cdad94b3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4f6b6970612f6c61726176656c2d6d6f64656c2d6a736f6e2d73746f726167652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Okipa/laravel-model-json-storage/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/8f906954afd118c17f6390fb0eeb91519c71f062eb093c8130bf72887c1a7ae5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4f6b6970612f6c61726176656c2d6d6f64656c2d6a736f6e2d73746f726167652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Okipa/laravel-model-json-storage/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/dd78c8a81daa81df78e6e2d12d8bcd0805cb055453dec910f98e83a8d56fe9d9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4f6b6970612f6c61726176656c2d6d6f64656c2d6a736f6e2d73746f726167652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Okipa/laravel-model-json-storage/?branch=master)

**⚠️ This package has been abandonned ⚠️**
Do not hesitate to contact me if you want to make it evolve and to maintain it.

Storing your models in a json file rather than in database (single or few lines recording) can be a good option.
This package saves you to create a table for a ridiculous amount of lines, improves the data recovery performances, and allows you to store and access to your models from a json files as you would do it in database.

---

To read before use
------------------

[](#to-read-before-use)

Please keep in mind that :

- The purpose of this package is to store your model instances in json.
- Consequently, the json file is always entirely read when you access to your data
- Consequently, you should **NOT** use this package if you have a lot of instances to store, it could cause performance issues rather than improve it.
- All the query-related and model-related functionalities are not available (especially those which use database), this package has been made for quite simple use cases.
- This package enables you to manipulate models as if it they would been stored in database but it always uses the [Illuminate\\Support\\Collection methods](https://laravel.com/docs/5.4/collections) methods under the hood.

---

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

[](#installation)

- Install the package with composer :

```
composer require okipa/laravel-model-json-storage
```

- Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider. If you don't use auto-discovery or if you use a Laravel 5.0- version, add the package service provider in the `register()` method from your `app/Providers/AppServiceProvider.php` :

```
// laravel model json storage
// https://github.com/Okipa/laravel-model-json-storage
$this->app->register(Okipa\LaravelModelJsonStorage\ModelJsonStorageServiceProvider::class);
```

---

Usage
-----

[](#usage)

First, add the `ModelJsonStorage` trait in your model.

```
class MyTestModel extends Illuminate\Database\Eloquent\Model
{
    use Okipa\LaravelModelJsonStorage\ModelJsonStorage;

    [...]
}
```

Then, just manipulate your model normally.
After a storage, you will see a json file named with your model title in the path defined in the `model-json-storage` config file.

```
$testModel = app(MyTestModel::class)->create([
    'name' => 'John Doe',
    'email' => 'john@doe.com',
    'password' => Hash::make('secret'),
]);
```

```
$testModel = app(MyTestModel::class)->all();
```

```
$testModel = app(MyTestModel::class)->where('email', 'john@doe.com')->first();
```

```
$testModel->update([
    'name' => 'Gary Cook'
]);
```

```
$testModel->delete();
```

---

Customize configuration
-----------------------

[](#customize-configuration)

To personalize the package configuration, you have to publish it first with the following script :

```
php artisan vendor:publish --tag=model-json-storage::config
```

Then, open the published package configuration file (`config/model-json-storage.php`) and override the default configuration by setting your own values for the following items :

- json storage path
- ... that's all for now.

---

API
---

[](#api)

The most used query-related and model-related methods have been overridden to allow you to use your json stored model as usual.
Retrieve the list of the available methods bellow.
However, if you want to add a method for your personal needs, do not hesitate to improve this package with a PR.

### Available Illuminate\\Database\\Eloquent\\Model methods

[](#available-illuminatedatabaseeloquentmodel-methods)

- [save()](https://laravel.com/api/5.0/Illuminate/Database/Eloquent/Model.html#method_save)
- [update()](https://laravel.com/api/5.0/Illuminate/Database/Eloquent/Model.html#method_update)
- [delete()](https://laravel.com/api/5.0/Illuminate/Database/Eloquent/Model.html#method_delete)
- [all()](https://laravel.com/api/5.0/Illuminate/Database/Eloquent/Model.html#method_all)

### Available Illuminate\\Database\\Query\\Builder methods

[](#available-illuminatedatabasequerybuilder-methods)

- [get()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_get)
- [Select()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_select)
- [addSelect()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_addSelect)
- [where()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_where)
- [whereNull()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_whereNull)
- [whereNotNull()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_whereNotNull)
- [orderBy()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_orderBy)
- [orderByDesc()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_orderByDesc)
- [whereIn()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_whereIn)
- [whereNotIn()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_whereNotIn)
- [find()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_find)
- [findOrFail()](https://laravel.com/api/5.0/Illuminate/Database/Eloquent/Builder.html#method_findOrFail)
- [paginate()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_paginate)
- [value()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_value)
- [pluck()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_pluck)
- [count()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_count)
- [min()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_min)
- [max()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_max)
- [avg()](https://laravel.com/api/5.0/Illuminate/Database/Query/Builder.html#method_avg)

### Available Illuminate\\Database\\Concerns\\BuildsQueries methods

[](#available-illuminatedatabaseconcernsbuildsqueries-methods)

- [first()](https://laravel.com/api/5.0/Illuminate/Database/Concerns/BuildsQueries.html#method_first)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

5

Last Release

2904d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc5b2b60afe2f6f28bd3ef5105fc1883386967efcc744b1b6829b8eb289f5a91?d=identicon)[Okipa](/maintainers/Okipa)

---

Top Contributors

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

---

Tags

jsonlaravelmodelokipapackagephpstoragephpjsonlaravelpackagemodelstorageokipa

### Embed Badge

![Health badge](/badges/okipa-laravel-model-json-storage/health.svg)

```
[![Health](https://phpackages.com/badges/okipa-laravel-model-json-storage/health.svg)](https://phpackages.com/packages/okipa-laravel-model-json-storage)
```

###  Alternatives

[zing/laravel-flysystem-obs

Flysystem Adapter for OBS

1211.2k](/packages/zing-laravel-flysystem-obs)

PHPackages © 2026

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