JWT Framework
Search…
JWE serializers

JWE Serializer Manager Factory Service

A JWESerializerManagerFactory is available as a service in your application container:
1
<?php
2
use Jose\Component\Encryption\JWESerializerManagerFactory;
3
4
$jweSerializerManagerFactory = $container->get(JWESerializerManagerFactory::class);
Copied!
With this factory, you will be able to create the JWESerializerManager you need:
1
$jweSerializerManager = $jweSerializerManagerFactory->create(['jwe_compact']);
Copied!
You can now use the JWESerializerManager as explained in the JWE Creation/Loading section.
Available JWE serialization modes are:
    jwe_compact
    jwe_json_general
    jwe_json_flattened

JWE Serializer Manager As Service

There is also another way to create a JWESerializerManager object: using the bundle configuration.
1
jose:
2
jwe:
3
serializers:
4
serializer1:
5
serializers: ['jwe_compact']
6
is_public: true
Copied!
With the previous configuration, the bundle will create a public JWE Serializer Manager service named jose.jwe_serializer.serializer1 with selected serialization modes.
1
<?php
2
$jweSerializerManager = $container->get('jose.jwe_serializer.serializer1');
Copied!

Custom Tags

You can add custom tags and attributes to the services you create.
1
jose:
2
jwe:
3
serializers:
4
serializer1:
5
serializers: ['jwe_compact']
6
tags:
7
tag_name1: ~
8
tag_name2: {attribute1: 'foo'}
Copied!
Last modified 1yr ago