> For the complete documentation index, see [llms.txt](https://web-token.spomky-labs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://web-token.spomky-labs.com/migration/from-v1.x-to-v2.0.md).

# From v1.x to v2.0

This guide will help you upgrade your application from JWT Framework v1.x to v2.0. While minor version upgrades are generally straightforward, major version upgrades involve breaking changes that require careful attention.

{% hint style="info" %}
**Estimated Migration Time:** 1-3 hours for a typical application **Difficulty Level:** Moderate
{% endhint %}

## Overview of Changes

Version 2.0 introduces several important changes:

* Removal of static factory methods in favor of constructors
* Deprecation of compression methods (security recommendation)
* Removal of unnecessary converter classes
* Improved API consistency across components

## Migration Steps

## Update the libraries

First of all, you have to make sure you are using the last v1.x release (1.3.8).

## Spot deprecations

Next, you have to verify you don’t use any deprecated class, interface, method or property. If you have PHPUnit tests, [you can easily get the list of deprecation used in your application](https://symfony.com/doc/current/components/phpunit_bridge.html).

### List of deprecations:

* `Jose\Component\Core\JWK::create()`: this static function is removed. Use the constructor instead
* `Jose\Component\Core\JWKSet::createFromKeys()` : this static function is removed. Use the constructor instead
* `Jose\Component\Core\Converter\JsonConverter`: this interface is removed. No replacement.
* `Jose\Component\Core\Converter\StandardConverter`: this class is removed. No replacement.
* `Jose\Component\Encryption\Compression\CompressionMethodManager::create()`: this static function is removed. Use the constructor instead
* `Jose\Component\Encryption\Compression\GZip`: this class is removed. No replacement.
* `Jose\Component\Encryption\Compression\ZLib`: this class is removed. No replacement.
* `Jose\Component\Encryption\Serializer\JWESerializerManager::list()`: this method is removed. Please use `names()`
* `Jose\Component\Checker\ClaimCheckerManager::create()` : this static function is removed. Use the constructor instead
* `Jose\Component\Checker\HeaderCheckerManager::create()` : this static function is removed. Use the constructor instead
* `Jose\Component\Core\AlgorithmManager::create()` : this static function is removed. Use the constructor instead
* `Jose\Component\Encryption\Serializer\JWESerializerManager::create()` : this static function is removed. Use the constructor instead
* `Jose\Component\Signature\Serializer\JWSSerializerManager::create()` : this static function is removed. Use the constructor instead

With the Symfony bundle, the configuration option `jose.json_converter` is removed.

## Add missing dependencies

In v1.x, when you install the `web-token/jwt-signature` or `web-token/jwt-encryption`, the algorithms are automatically install.

In v2.0, you must explicitly install the algorithms you need. Please refer to the [signature algorithms page](/the-components/signed-tokens-jws/signature-algorithms.md) or [encryption algorithms page](/the-components/encrypted-tokens-jwe/encryption-algorithms.md) to know what package you need to install.

## Upgrade the libraries

It is now time to upgrade the libraries. In your composer.json, change all `web-token/*` dependencies from `v1.x` to `v2.0`. When done, execute `composer update`.

You can also update all other dependencies if needed. You can list upgradable libraries by calling `composer outdated`. This step is not mandatory, but highly recommended.


---

# 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://web-token.spomky-labs.com/migration/from-v1.x-to-v2.0.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.
