PHPackages                             muhammetsafak/data-versions - 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. muhammetsafak/data-versions

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

muhammetsafak/data-versions
===========================

Data Versions and Differences

0.1(3y ago)12MITPHPPHP &gt;=7.4

Since Dec 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/muhammetsafak/DataVersions)[ Packagist](https://packagist.org/packages/muhammetsafak/data-versions)[ RSS](/packages/muhammetsafak-data-versions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Data Versions and Differance
============================

[](#data-versions-and-differance)

This library was written to version data and calculate differences between historical versions.

Requirements
------------

[](#requirements)

- PHP 7.4 or later

Installation
------------

[](#installation)

```
composer require muhammetsafak/data-versions

```

Usage
-----

[](#usage)

```
require_once 'vendor/autoload.php';
use \MuhammetSafak\DataVersions\{Version, Diff};

/** @var Version[] $versions */
$versions = [
    new Version(['name' => 'Muhammet', 'surname' => 'Şafak'], ['user' => 10]),
    new Version(['name' => 'Muhammet', 'surname' => 'Şafak'], ['user' => 12]),
    new Version(['name' => 'Muhammet', 'surname' => 'Şafak', 'age' => 30], ['user' => 5]),
    new Version(['name' => 'Ahmet', 'surname' => 'Şafak'], ['user' => 7]),
];

$compare = new Version(['name' => 'Muhammet'], ['user' => 1]);
foreach ($versions as $version) {
    echo '' . $version->getID() . ' Changer: #' . $version->getInfo()['user'] . '';

    $diff = $compare->diff($version);

    if ($diff->isDiff()) {
        echo '' . PHP_EOL;
        foreach ($differences as $difference) {
            echo '' . $difference['name'] . ' : ';
            switch ($difference['type']) {
                case Diff::ADDED:
                    echo ' added "' . $difference['value'] . '"';
                    break;
                case Diff::CHANGING:
                    echo '"' . $difference['value'][0] . '" has been replaced with; "' .$difference['value'][1] . '"';
                    break;
                case Diff::REMOVED:
                    echo ' removed "' . $difference['value'] . '"';
                    break;
            }
            echo '' . PHP_EOL;
        }
        echo '';
    } else {
        echo 'It does not contain any changes.';
    }

    $compare = $version;
}
```

Structures
==========

[](#structures)

```
namespace MuhammetSafak\DataVersions;

class Version
{
    public function __construct(array $data, array $info = [], ?string $id = null, ?int $time = null);
    public function getID(): string;
    public function toJSON(): string;
    public function getDate(string $format = 'c'): string;
    public function getData(): array;
    public function getInfo(): array;
    public function diff(\MuhammetSafak\DataVersions\Version $nextVersion): \MuhammetSafak\DataVersions\Diff;
}

class Diff
{
    public const REMOVED = 0;
    public const ADDED = 1;
    public const CHANGING = 2;

    public function __construct(array $diff, array $info = []);
    public function getDiff(): array;
    public function getInfo(): array;
    public function isDiff(): bool;
    public function count(): int;
}
```

Credits
-------

[](#credits)

- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) &lt;&gt;

License
-------

[](#license)

Copyright © 2022 [MIT Licence](./LICENSE)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1252d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b6b34f3ac8938d8ee52ba3bd260680855dc5715c7b2929d9380de30d15a67dd?d=identicon)[muhammetsafak](/maintainers/muhammetsafak)

---

Top Contributors

[![muhammetsafak](https://avatars.githubusercontent.com/u/104234499?v=4)](https://github.com/muhammetsafak "muhammetsafak (1 commits)")

### Embed Badge

![Health badge](/badges/muhammetsafak-data-versions/health.svg)

```
[![Health](https://phpackages.com/badges/muhammetsafak-data-versions/health.svg)](https://phpackages.com/packages/muhammetsafak-data-versions)
```

###  Alternatives

[froiden/laravel-installer

Laravel web installer

10883.9k](/packages/froiden-laravel-installer)

PHPackages © 2026

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