2017 © Pedro Peláez
 

library 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.

image

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.

  • Wednesday, May 30, 2018
  • by Okipa
  • Repository
  • 1 Watchers
  • 4 Stars
  • 42 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 6 Versions
  • 147 % Grown

The README.md

laravel-model-json-storage

Source Code Latest Version Total Downloads License: MIT Build Status Code Coverage Scrutinizer Code Quality, (*1)

:warning: This package has been abandonned :warning:
Do not hesitate to contact me if you want to make it evolve and to maintain it., (*2)

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., (*3)


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 methods under the hood., (*4)


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

First, add the ModelJsonStorage trait in your model., (*5)

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., (*6)

$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

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

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., (*8)


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., (*9)

Available Illuminate\Database\Eloquent\Model methods

Available Illuminate\Database\Query\Builder methods

Available Illuminate\Database\Concerns\BuildsQueries methods

The Versions

30/05 2018

dev-master

9999999-dev https://github.com/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.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel php json model storage package okipa

30/05 2018

1.0.4

1.0.4.0 https://github.com/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.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel php json model storage package okipa

30/05 2018

1.0.3

1.0.3.0 https://github.com/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.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel php json model storage package okipa

07/05 2018

1.0.2

1.0.2.0 https://github.com/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.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel php json model storage package okipa

14/03 2018

1.0.1

1.0.1.0 https://github.com/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.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel json model storage okipa

04/03 2018

1.0.0

1.0.0.0 https://github.com/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.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arthur Lorent

laravel json model storage okipa