kevinsillo/phpjsondb

PhpJsonDB is a PHP library for managing databases using JSON files. It provides a simple, file-system based approach to database management with type-safe operations.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/kevinsillo/phpjsondb

dev-main 2025-03-24 23:16 UTC

This package is auto-updated.

Last update: 2025-12-25 01:03:35 UTC


README

🌐 Overview

PhpJsonDB is a modern PHP library for managing databases using JSON files. It provides a simple, file-system based approach to database management with type-safe operations. Perfect for small to medium projects! πŸš€

🌟 Key Features

  • πŸ’‘ Lightweight JSON-based database management
  • πŸ“ File-system based table storage
  • πŸ”’ Type-safe CRUD operations
  • πŸ” Advanced querying capabilities
  • πŸ“€ Export and import functionality

πŸ› οΈ Installation

# Instala fΓ‘cilmente con Composer πŸŽ‰
composer require kevinsillo/phpjsondb

🧰 Methods Overview

πŸ”§ Method πŸ“ Description
getTables() Gets a list of all tables.
getTablesInfo() Gets detailed information of all tables.
tableRecords() Return the number of all records in the table.
tableExists() Checks if a table (directory) exists.
selectTable() Selects a table (directory) to work with.
createTable() Creates a new table (directory).
truncate() Truncates the table, removing all records but keeping the table and its control file.
dropTable() Deletes a table (directory) and all its records.
select() Selects specific fields to be returned in the query result.
where() Applies search criteria with type-safe operators.
findById() Finds a record by its ID.
insertAuto() Inserts a new record using an auto-incremental ID.
insert() Inserts a new record.
update() Updates records selected.
updateById() Updates an existing record.
delete() Deletes records selected.
deleteById() Deletes a record.
limit() Applies pagination to the query.
orderBy() Applies ordering to the result set.
getRecords() Gets the records in the current result set.
countRecords() Gets the count of records in the current result set.
existsById() Checks if a record with the given ID exists.
hasRecords() Checks if any records exist in the current result set.
exportDatabase() Exports the entire database to a JSON file.
importDatabase() Imports a database from a JSON file.

πŸ’‘ Quick Example

$db = new PhpJsonDB();
$db->table('users')->insert([
    'name' => 'John Doe',
    'email' => 'john@example.com'
]);

🀝 Contributing

Contributions are welcome! 🌈 Submit pull requests or open issues.

πŸ“„ License

MIT License