Download the PHP package almhdy/json-shelter without Composer
On this page you can find all versions of the php package almhdy/json-shelter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download almhdy/json-shelter
More information about almhdy/json-shelter
Files in almhdy/json-shelter
Package json-shelter
Short Description The **JsonShelter** class provides a simple, file-based JSON database solution. It allows for creating, reading, updating, and deleting records in structured JSON format. With an intuitive interface, it manages data storage in specified directories, ensuring seamless access to your data. Each record is uniquely identifiable, simplifying data manipulation and organization. Ideal for lightweight applications or prototyping, **JsonShelter** is easy to implement and maintain, making it a suitable choice for developers looking for a straightforward database solution.
License MIT
Informations about the package json-shelter
ποΈ JsonShelter - Your Friendly PHP JSON Manager
Welcome to JsonShelter! This is a nifty PHP library designed to help you store and manage your JSON data with ease. Let's dive into the installation and usage instructions! π
Installation βοΈ
You can bring JsonShelter into your project using one of the methods below:
Method 1: Install via Composer π΅
Use Composer to include the package seamlessly in your project:
Method 2: Clone the Repository π₯³
Prefer to have a local copy? Clone the repository directly from GitHub:
Method 3: Download as Archive π¦
You can also download a release archive from GitHub. Simply visit the releases page and grab the latest version as a ZIP file. Extract it to your project directory.
Usage π
Using JsonShelter in your project is easy-peasy! Include the class by using Composer or directly. Letβs walk through it!
Option 1: Using Composer π₯
If you used Composer, just include the autoload file and get started! Hereβs an example:
Option 2: Directly Including the File π
If you cloned the repo or downloaded the archive, include the JsonShelter.php
file directly. Adjust the path as needed!
Encryption π‘οΈ
You can easily enable or disable encryption for your records. This is a handy feature to keep your data secure!
-
Enable Encryption:
- Disable Encryption:
Record Operations π
You can perform CRUD operations (Create, Read, Update, Delete) with the following methods:
-
Create a record: βοΈ
-
Read a record: π
-
Update a record: π
- Delete a record: β
Model Class
The Model
class provides an ORM-like interface to interact with the JsonShelter
class.
Initialization
First, initialize a Model
for a specific table:
Inserting Data
Inserting data using the Model
:
Reading Data
Reading all records:
Reading a specific record by ID:
Updating Data
Updating a record:
Deleting Data
Deleting a record:
Querying Data
Filtering records:
Searching within a field:
Ordering and limiting data:
JsonEncryptor Class
The JsonEncryptor
class handles encryption and decryption of data.
Initialization
Initialize the JsonEncryptor
class with a secret key and initialization vector:
Encrypting Data
Encrypting data:
Decrypting Data
Decrypting data:
Handling Large Datasets
Encrypting a large file using streams:
Decrypting a large file using streams:
Additional Methods Overview
Our database manager π, now affectionately called "db," comes packed with handy extra methods π that make managing JSON files and checking their directory status a breeze! Letβs explore them.
Check Directory Status
Before diving into the JSON realm, make sure your directory is in tip-top shape! This method checks if itβs readable and writable:
Get Size and Permissions of JSON Files
Curious about your JSON files? This method gives you the lowdown on their size and permissions:
Set Best Permissions for JSON Files
Letβs tighten up security! This method automatically sets the best permissions for your JSON files:
Conclusion π
And that's a wrap! π You've now unlocked the power of JsonShelter, making it super simple to integrate into your PHP applications! π With just a few easy steps, you're ready to harness the power of file-based JSON data management, complete with encryption and ORM-like capabilities.
Remember, every line of code brings you closer to your goals. Embrace the journey and happy coding! ππ»β¨