PHPackages                             sebaperez/phpdatasaver - 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. sebaperez/phpdatasaver

ActiveLibrary

sebaperez/phpdatasaver
======================

Allows to easily save data in a mysql database

019PHP

Since Sep 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sebaperez/phpdatasaver)[ Packagist](https://packagist.org/packages/sebaperez/phpdatasaver)[ RSS](/packages/sebaperez-phpdatasaver/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHP DataSaver
=============

[](#php-datasaver)

Description
===========

[](#description)

You can easily define a MySQL table structure and fill up with data. This is great for simple scripts that need to save data quickly

Build status
============

[](#build-status)

[![Build Status](https://camo.githubusercontent.com/19cf6abe477efd7aa8fbbb94213df8e9cebb10aec696449577812856542e2c13/68747470733a2f2f6170692e7472617669732d63692e636f6d2f73656261706572657a2f7068706461746173617665722e7376673f6272616e63683d6d6173746572267374617475733d63726561746564)](https://camo.githubusercontent.com/19cf6abe477efd7aa8fbbb94213df8e9cebb10aec696449577812856542e2c13/68747470733a2f2f6170692e7472617669732d63692e636f6d2f73656261706572657a2f7068706461746173617665722e7376673f6272616e63683d6d6173746572267374617475733d63726561746564)

Usage
=====

[](#usage)

Simply import the **DataSaver\\Table** module

Table definition
----------------

[](#table-definition)

```
$table = \DataSaver\Table::model([
	"db" => $dbName,
	"name" => $tableName,
	"columns" => [
		[ "name" => "column1", "type" => "int", "options" => "auto_increment primary key" ],
		[ "name" => "column2", "type" => "varchar(255)" ],
		[ "name" => "column3", "type" => "int" ]
	]
]);

```

It will create both a new database and table if not exist

Insert data into the table
--------------------------

[](#insert-data-into-the-table)

```
$table->insert([ "column2" => "value", "column3" => 2 ]);

```

Insert or update data into the table
------------------------------------

[](#insert-or-update-data-into-the-table)

```
$table->insertOrUpdate([ "column3" => 1, "column1" => 1 ]);

```

It is mandatory to declare all primary keys in the statement in order to properly execute an update

Retrieve data from table
------------------------

[](#retrieve-data-from-table)

```
$table->select("column2, column3 where column1 > 1");

```

It uses a **pseudo query**. As this module already knows the table you are refering to, you can omit the "select" and "from table" from the query. Join or other kind of operations between tables are not supported. It will return an array with all matches as associative arrays.

Truncate table
--------------

[](#truncate-table)

```
$table->truncate();

```

###  Health Score

15

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/25f5c9f7459f42640be22ea47bb912e943d583dd62c2e5204e03741f3baad294?d=identicon)[sebaperez](/maintainers/sebaperez)

---

Top Contributors

[![sebaperez](https://avatars.githubusercontent.com/u/12091528?v=4)](https://github.com/sebaperez "sebaperez (18 commits)")

### Embed Badge

![Health badge](/badges/sebaperez-phpdatasaver/health.svg)

```
[![Health](https://phpackages.com/badges/sebaperez-phpdatasaver/health.svg)](https://phpackages.com/packages/sebaperez-phpdatasaver)
```

PHPackages © 2026

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