PHPackages                             selcukmart/data-store-library-y42 - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. selcukmart/data-store-library-y42

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

selcukmart/data-store-library-y42
=================================

1.0.0(4y ago)03PHP

Since Feb 17Pushed 4y ago2 watchersCompare

[ Source](https://github.com/selcukmart/DataStoreLibraryY42)[ Packagist](https://packagist.org/packages/selcukmart/data-store-library-y42)[ RSS](/packages/selcukmart-data-store-library-y42/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

```
composer require selcukmart/data-store-library-y42

```

### What does it?

[](#what-does-it)

It can store/get/change any data.

It manipulates the data as;

- Record inserts &amp; batch inserts
- Record query/retrieval
- Query filters (equality operations only), limit &amp; offset
- Update and delete operations

The code has unit tests. It can be tested after cloned.

```
tests/SessionStorageTest.php

```

### How to use

[](#how-to-use)

For example we choose using Session Storage;

Insert Example;

```
    $storage = $_SESSION['DataStoreLibrary'];
    $storage_factory = SessionFactory::create($storage);
    $expected = [
            'a' => [
                'b' => 'Test'
            ]
        ];
    $storage_factory->insert($expected);
    $hash = $storage_factory->getHash();
```

Batch Insert Example;

```
    $storage = $_SESSION['DataStoreLibrary'];
    $storage_factory = SessionFactory::create($storage);
    $batch_insert_array = [
            'Contrary to popular belief, Lorem Ipsum is not simply random text.',
            'Lorem Ipsum is simply dummy text of the printing and typesetting',
            'There are many variations of passages of Lorem Ipsum available',
            'It is a long established fact that a reader will be distracted by the',
        ];
    $results = $storage_factory->insertBatch($batch_insert_array);
```

Update Example;

```
    $storage = $_SESSION['DataStoreLibrary'];
    $storage_factory = SessionFactory::create($storage);
    $str1 = 'Test String';
        $str2 = 'Test String2';
        $storage_factory->insert($str1);
        $old_hash = $storage_factory->getHash();
        $storage_factory->update($str1,$str2);
```

Filter Example;

```
    $storage = $_SESSION['DataStoreLibrary'];
    $storage_factory = SessionFactory::create($storage);
    $str = 'Contrary to popular belief, Lorem Ipsum is not simply random text.';
        $str2 = 'Lorem Ipsum is simply dummy text of the printing and typesetting';
        $str3 = 'There are many variations of passages of Lorem Ipsum available';
        $str4 = 'It is a long established fact that a reader will be distracted by the';
        $storage_factory->insert($str);
        $storage_factory->insert($str2);
        $storage_factory->insert($str3);
        $storage_factory->insert($str4);
        $results = $storage_factory->filter($str3);
        echo $results[0]->getHash();
        echo $results[0]->getItem();
```

Lists Example;

```
    $storage = $_SESSION['DataStoreLibrary'];
    $storage_factory = SessionFactory::create($storage);
    $batch_insert_array = [
            'Contrary to popular belief, Lorem Ipsum is not simply random text.',
            'Lorem Ipsum is simply dummy text of the printing and typesetting',
            'There are many variations of passages of Lorem Ipsum available',
            'It is a long established fact that a reader will be distracted by the',
        ];
    $results = $storage_factory->insertBatch($batch_insert_array);
    $result = $storage_factory->lists(limit: 2, offset: 2);
```

Delete Example;

```
    $storage = $_SESSION['DataStoreLibrary'];
    $storage_factory = SessionFactory::create($storage);
    $expected = 'Test String';
    $storage_factory->insert($expected);
    $hash = $storage_factory->getHash();
    $storage_factory->delete($hash, is_data: false); // OR $storage_factory->delete($expected, is_data: true);
```

### If you want to use other providers

[](#if-you-want-to-use-other-providers)

PDOFactory creates own table named as "data\_storage" and uses it. If you want to set your table name please add the config: 'TABLE'=&gt;'abc\_table'

```
    $config = [
        'SQLDRIVER'=>'mysql',
        'DBNAME'=>'data_store',
        'SQLHOST'=>'localhost',
        'DBUSER'=>'root',
        'DBPASS'=>''
    ];
    $storage_factory = PDOFactory::create($config);
```

### If you want to create own provider

[](#if-you-want-to-create-own-provider)

For example Aws S3;

```
class AWSS3Factory  extends AbstractDataStoreFactory implements FactoryInterface
{
    public function __construct(private readonly array $sc_config)
    {
    }

    public static function create(array $config): AWSS3Factory
    {
        return new self($config);
    }

    public function delete($data, bool $is_data)
    {
        // TODO: Implement delete() method.
    }

    public function insert($data)
    {
        // TODO: Implement insert() method.
    }

    public function insertBatch(array $data)
    {
        // TODO: Implement insertBatch() method.
    }

    public function filter(string $str): array
    {
        // TODO: Implement filter() method.
    }

    public function update($old_data, $new_data)
    {
        // TODO: Implement update() method.
    }

    public function retrieve(string $hash)
    {
        // TODO: Implement retrieve() method.
    }

    public function lists(int $limit, int $offset): array
    {
        // TODO: Implement lists() method.
    }
}
```

AbstractDataStoreFactory

```
abstract class AbstractDataStoreFactory
{
    use ErrorMessagesWithResultTrait;

    protected string $hash;
    protected mixed $data;
    protected DataStorageConvert $DataStorageConvert;

    protected function setData($data): void
    {
        $this->data = $data;
    }

    /**
     * @return string
     * @author selcukmart
     * 16.02.2022
     * 15:52
     */
    protected function getConvertedData(): string
    {
        $this->DataStorageConvert = DataStorageConvert::getInstance($this->data);
        $this->DataStorageConvert->execute();
        $this->hash = $this->DataStorageConvert->getHash();
        return $this->hash;
    }

    /**
     * @return string
     */
    public function getHash(): string
    {
        return $this->hash;
    }

    /**
     * @param int|string $hash
     * @param array $results
     * @return array
     * @author selcukmart
     * 17.02.2022
     * 10:54
     */
    protected function setResults(int|string $hash,mixed $item, array $results): array
    {
        $filter_object = new FilterResult();
        $filter_object->setHash($hash);
        $filter_object->setItem($item);
        $results[] = $filter_object;
        return $results;
    }
}
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1543d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d4ac9b4f7a2d8a39f741a8e6fd69e539f1bd66fdcff6a301a44f2a1c6f5e198c?d=identicon)[selcukmart](/maintainers/selcukmart)

---

Top Contributors

[![selcukmart](https://avatars.githubusercontent.com/u/8598667?v=4)](https://github.com/selcukmart "selcukmart (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/selcukmart-data-store-library-y42/health.svg)

```
[![Health](https://phpackages.com/badges/selcukmart-data-store-library-y42/health.svg)](https://phpackages.com/packages/selcukmart-data-store-library-y42)
```

###  Alternatives

[components/mathjs

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.

15.0k3.8k](/packages/components-mathjs)[aura/payload-interface

An interface package for Domain Payload implementations.

13392.7k4](/packages/aura-payload-interface)[njxqlus/filament-lightbox

Lightbox entry for Filament

2054.6k](/packages/njxqlus-filament-lightbox)

PHPackages © 2026

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