> 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](https://docs.opensoutheners.com/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](https://docs.opensoutheners.com/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](https://docs.opensoutheners.com/oss/flex-url/getting-started/quick-start.md).
* Percent-decoding, comma handling, and `+`/space semantics all changed — read [Encoding Contract](https://docs.opensoutheners.com/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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
