Giter Club home page Giter Club logo

okipa / laravel-model-json-storage Goto Github PK

View Code? Open in Web Editor NEW
24.0 4.0 16.0 48 KB

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.

License: MIT License

PHP 100.00%
laravel model json storage php okipa package

laravel-model-json-storage's People

Contributors

okipa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

laravel-model-json-storage's Issues

overrriden eloquent

Hi! Thanks for the tool! Testing currently, good job, but got one issue. So, now eloquent all() method is overriden by your lib and I can not use usual eloquent database-ment $chanels = Chanel::all(); to get all chanels from actual db, if I do not need json-storage?

Pretty print the stored JSON

One of the more appealing advantage of storing data in JSON rather than say sqlite is that it has potential to be properly versioned controlled via git. This cannot be leveraged upon as the current implementation stores the JSON data as a single line.

I would like to propose passing the JSON_PRETTY_PRINT constant in the toJson method during model saving so that it would pretty print the JSON. This would allow git to detect changed lines (single property inside the JSON) as opposed to replacing the whole collection should a merge conflict occur.

However this does increase the file size, if this is a concern, which it shouldn't be, you might want to expose this in the config file.

This would open up new possibilities and usecases for this package. Think of a team of devs working with a same set of versioned controlled JSON data without worrying much when a conflict occur.

Eloquent relations

Hi, thanks for the package, I was wondering if its possible to use relations like BelongTo from other models with this package?

Thank you for your time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.