> For the complete documentation index, see [llms.txt](https://docs.opensoutheners.com/oss/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opensoutheners.com/oss/flex-url/migration/upgrading-from-v1.md).

# Upgrading from 1.x

Migrate from the 1.x FlexibleUrl class (TypeScript-only) to the 2.x/3.x FlexUrl builder.

{% hint style="info" %}
1.x was a TypeScript-only package (`FlexibleUrl`). The PHP mirror was introduced starting at 2.0.0 as part of this rewrite, so there is nothing to migrate on the PHP side — a PHP project adopting `open-southeners/flex-url` starts directly on the current API described throughout these docs.
{% endhint %}

v1's `FlexibleUrl` kept only the **origin** of the URL it was constructed from, so `router.visit(url.toString())` navigated to `/` — the pathname was silently dropped. If you worked around that with something like:

```ts
router.visit(window.location.pathname + '?' + url.toString().split('?')[1]);
```

replace it with:

```ts
router.visit(url.toRelativeUrl());
```

The workaround above still runs on the current version, but it is now:

* **Redundant** — the pathname is preserved by the builder itself, see [Full URL fidelity](/oss/flex-url/readme.md#features).
* **Broken in a new way** — it produces `/path?undefined` when no parameters are set.
* **Lossy** — it mangles the hash, which `toRelativeUrl()` preserves.

See [Output Forms](/oss/flex-url/reading-urls/output-forms.md) for the full comparison between `toString()`, `toRelativeUrl()`, and `toRequestUri()`, and when to reach for each.

## Other 1.x → current differences worth knowing

* The `@flex-url/vue` adapter package has been retired — it is no longer maintained as part of this monorepo.
* Every builder method now returns a *new* instance rather than mutating the receiver — see [Quick Start](/oss/flex-url/getting-started/quick-start.md).
* Percent-decoding, comma handling, and `+`/space semantics all changed — read [Encoding Contract](/oss/flex-url/advanced/encoding-contract.md) if you relied on the previous parsing behaviour anywhere.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.opensoutheners.com/oss/flex-url/migration/upgrading-from-v1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
