PHPackages                             fratily/clone-with - 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. fratily/clone-with

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

fratily/clone-with
==================

0.2.0(2y ago)018Apache-2.0PHPPHP ^8.1

Since Nov 5Pushed 2y agoCompare

[ Source](https://github.com/fratily/clone-with)[ Packagist](https://packagist.org/packages/fratily/clone-with)[ RSS](/packages/fratily-clone-with/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

fratily/clone-with
==================

[](#fratilyclone-with)

[English README.md](README.en.md)

`fratily/clone-with`はPHPのオブジェクトクローンを拡張する関数を追加するライブラリです。

オブジェクトをクローンするときに任意のプロパティの値を書き換えられるようにします。 これは書き換えるプロパティがreadonlyでもprivateでも機能します。

NOTE: 現時点では継承しているスーパークラスのprivateプロパティを書き換えることはできません。 これは「スーパークラスのプライベートプロパティは隠ぺいされているし、外部から触られるべきではないんじゃね？」という作者の考えに基づいています。

使い方
---

[](#使い方)

このライブラリは、readonlyなプロパティで構成される不変オブジェクトをより使いやすくするために作成されました。

```
class Foo {
  public function __construct(
    public readonly string $value_string,
    public readonly int $value_int,
  ) {}

  public function withString(string $new_value)
  {
    return clone_with_new_props($this, ['value_string' => $new_value]);
  }

  public function withInt(int $new_value)
  {
    return clone_with_new_props($this, ['value_int' => $new_value]);
  }
}
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Every ~0 days

Total

3

Last Release

922d ago

PHP version history (2 changes)0.1.1PHP ^8.0

0.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c0575d05e23e7ef9b1046a7a922927199c86ef292ebb188758bb214621d7efc?d=identicon)[kento-oka](/maintainers/kento-oka)

---

Top Contributors

[![kento-oka](https://avatars.githubusercontent.com/u/30544668?v=4)](https://github.com/kento-oka "kento-oka (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fratily-clone-with/health.svg)

```
[![Health](https://phpackages.com/badges/fratily-clone-with/health.svg)](https://phpackages.com/packages/fratily-clone-with)
```

###  Alternatives

[magefan/module-conflict-detector

Detect extension conflicts

4872.6k2](/packages/magefan-module-conflict-detector)[michaelbelgium/youtube-to-mp3

Convert and search youtube video's via your own API

1751.1k](/packages/michaelbelgium-youtube-to-mp3)

PHPackages © 2026

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