# \[RFC\] Laminas composer replace - new releases approach

**URL:** <https://discourse.laminas.dev/t/rfc-laminas-composer-replace-new-releases-approach/1470>\
**Category:** Contributors\
**Tags:** rfc\
**Created:** [March 23, 2020, 9:48pm UTC](https://discourse.laminas.dev/t/rfc-laminas-composer-replace-new-releases-approach/1470 "2020-03-23T21:48:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![michalbundyra](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/michalbundyra/32/185_2.png) [@michalbundyra](https://discourse.laminas.dev/u/michalbundyra)\
**Post date:** [March 23, 2020, 9:48pm UTC](https://discourse.laminas.dev/t/rfc-laminas-composer-replace-new-releases-approach/1470/1 "2020-03-23T21:48:44Z")

</div>

# Goal

All new releases under Laminas organisation can replace legacy Zend Framework components.

# Background

During the migration to Laminas we have added:

```json
"replace": {
    "zend-xyz": "self.version"
}

```

into composer. It means that for example release `1.7.3` of `laminas-xyz` replaces ONLY `zend-xyz` in version `1.7.3`.

Now, in Laminas we have released several bugfix and new minor versions. Unfortunately we haven’t changed `replace` value in `composer.json` so it is still `self.version`. This is not working, because new version released under Laminas org has never been released under ZF org. It means newer releases from Laminas do not replace any ZF packages.

# Suggested Approach

1. create script to update `composer.json` of all Laminas components - set `replace` to the latest version released under ZF organisation, as an example: latest of `zend-xyz` is `1.7.3` ==\> we need update `master` and `develop` branches so we have in `composer.json`:

```json
"replace": {
    "zend-xyz": "^1.7.3"
}

```

1. fix all releases under Laminas, where `replace` was not updated in `composer.json`, for example:

- latest `zend-xyz` is `1.7.3`,
- we have released `laminas-xyz` `1.7.4` and `1.8.0` ==\> we should issue two new releases: `1.7.5` and `1.8.1`; both with:

```json
"replace": {
    "zend-xyz" : "^1.7.3"
}

```

1. we should remove `replace` from `composer.json` for **next major** releases of Laminas components.

---

<div class="post-metadata">

**Author:** ![matthew](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/matthew/32/14_2.png) [@matthew](https://discourse.laminas.dev/u/matthew)\
**Post date:** [March 26, 2020, 6:05pm UTC](https://discourse.laminas.dev/t/rfc-laminas-composer-replace-new-releases-approach/1470/2 "2020-03-26T18:05:16Z")

</div>

This would be for _new_ releases, correct?

If so, this _should_ be fine, as we follow semver. I’d like other TSC members to comment, though.

---

<div class="post-metadata">

**Author:** ![xerkus](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/xerkus/32/22_2.png) [@xerkus](https://discourse.laminas.dev/u/xerkus)\
**Post date:** [March 26, 2020, 6:11pm UTC](https://discourse.laminas.dev/t/rfc-laminas-composer-replace-new-releases-approach/1470/3 "2020-03-26T18:11:20Z")

</div>

~~I would prefer replace to be for `"^1.7"` rather than specific patch version. Otherwise~~ I agree, this is the only proper approach that will ensure access to the latest bug fixes

---

<div class="post-metadata">

**Author:** ![matthew](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/matthew/32/14_2.png) [@matthew](https://discourse.laminas.dev/u/matthew)\
**Post date:** [March 26, 2020, 6:13pm UTC](https://discourse.laminas.dev/t/rfc-laminas-composer-replace-new-releases-approach/1470/4 "2020-03-26T18:13:47Z")

</div>

> [@xerkus](#):
>
> I would prefer replace to be for `"^1.7"` rather than specific patch version.

That’s problematic from a QA perspective. If the project tests using `--prefer-lowest`, they’d now potentially get an _earlier_ version than they previously allowed.

---

<div class="post-metadata">

**Author:** ![xerkus](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/xerkus/32/22_2.png) [@xerkus](https://discourse.laminas.dev/u/xerkus)\
**Post date:** [March 26, 2020, 7:33pm UTC](https://discourse.laminas.dev/t/rfc-laminas-composer-replace-new-releases-approach/1470/5 "2020-03-26T19:33:43Z")

</div>

> [@matthew](#):
>
> That’s problematic from a QA perspective. If the project tests using `--prefer-lowest`

It is a very valid point. Users reported QA issues around `--prefer-lowest` with patched versions and it was quite inconvenient effect on CI.

---

<div class="post-metadata">

**Author:** ![michalbundyra](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/michalbundyra/32/185_2.png) [@michalbundyra](https://discourse.laminas.dev/u/michalbundyra)\
**Post date:** [March 29, 2020, 1:47pm UTC](https://discourse.laminas.dev/t/rfc-laminas-composer-replace-new-releases-approach/1470/6 "2020-03-29T13:47:22Z")

</div>

All packages are now updated and new releases has been issued.
