artigo / realtime-session
A Symfony session on Redis where parallel requests work on single values independently: one RedisJSON document per session, every value read, written and locked on its own.
Requires
- php: >=8.4.1
- ext-redis: >=6.1
- psr/container: ^1.1|^2.0
- psr/log: ^1.1|^2|^3
- symfony/event-dispatcher: ^8.2
- symfony/http-foundation: ^8.2
- symfony/http-kernel: ^8.2
- symfony/service-contracts: ^2.5|^3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0
- symfony/browser-kit: ^8.2
- symfony/config: ^8.2
- symfony/console: ^8.2
- symfony/css-selector: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/dom-crawler: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/routing: ^8.2
- symfony/security-bundle: ^8.2
- symfony/security-core: ^8.2
- symfony/security-csrf: ^8.2
- symfony/security-http: ^8.2
- symfony/twig-bridge: ^8.2
- symfony/twig-bundle: ^8.2
- symfony/web-profiler-bundle: ^8.2
Suggests
- symfony/console: For the realtime-session:functions:* and realtime-session:index:* commands
- symfony/framework-bundle: To set the session up through RealtimeSessionBundle
Provides
None
Conflicts
- symfony/config: <8.2
- symfony/console: <8.2
- symfony/dependency-injection: <8.2
- symfony/framework-bundle: <8.2
Replaces
None
This package is auto-updated.
Last update: 2026-12-06 00:48:04 UTC
README
A Symfony session on Redis where the requests of one browser work on single values in parallel and independently: every value is read, written and locked on its own, so they neither wait for each other nor overwrite each other.
Note
New: the API may still change before 1.0.
What it is for
A page of today sends several requests at once with the same session cookie: the page itself, a few fetch() calls, a poll, a second tab. Each of them reads the session and some of them write to it. A PHP session is one block of data, read as a whole when the request starts and written as a whole when it ends, and that leaves two ways to handle requests that overlap:
- Lock the session. PHP's files handler does: the second request waits until the first has finished, whatever the two were going to do. Eight requests that take 200 ms each answer one after another.
- Do not lock it. Symfony's
RedisSessionHandlerdoes not: every request reads the same start, changes its copy and writes the whole copy back. The last one to finish wins, and what the others wrote is gone.
This package stores a session as one RedisJSON document and works on single values of it. A read fetches the value asked for. A write changes that value at once, on the server, in one step. Two requests that change different values do not meet at all, and a value both change can be counted, appended to, updated or locked on its own.
Example. One browser sends eight requests in the same moment. Each takes 200 ms, adds one item to a basket in the session and counts itself.
| Session storage | Last answer after | Basket holds | Counted |
|---|---|---|---|
| PHP's files handler (the session is locked) | 1603 ms | 8 of 8 items | 8 |
Symfony's RedisSessionHandler (no lock, written as a whole) |
201 ms | 1 of 8 items | 1 |
| This package | 204 ms | 8 of 8 items | 8 |
The third row adds each item with append() and counts with increment(), each one step on the server. A request that reads a value, changes it in PHP and writes it back with set() loses what other requests wrote in between, here as with any storage that does not lock the whole session; update() and getLocked() are for that.
So the choice between waiting and losing writes goes away: the eight requests answer side by side, 3 ms later than without any lock, and the session holds what all of them wrote.
examples/parallel-requests.php is that run, the three storages one after another:
$ REDIS_DSN=redis://127.0.0.1:6390 php examples/parallel-requests.php eight requests of one browser at once, 200 ms of work each PHP files handler (the session is locked) answered after 201 ms answered after 401 ms ... five more answered after 1603 ms basket holds 8 of 8 items, counted 8 requests, last answer after 1603 ms Symfony RedisSessionHandler (no lock, the session is written as a whole) answered after 201 ms ... seven more basket holds 1 of 8 items, counted 1 requests, last answer after 201 ms artigo/realtime-session (each value on its own) answered after 203 ms ... six more answered after 204 ms basket holds 8 of 8 items, counted 8 requests, last answer after 204 ms
The figures are from PHP 8.5.13 with phpredis 6.3.0 and Redis 8.12 on one Linux machine; five runs gave the same counts, and last answers within 1 ms of these.
Installation
composer require artigo/realtime-session
It needs PHP 8.4.1 or later with phpredis 6.1 or later, Symfony 8.2 or later and Redis 8.10 or later (see Requirements).
Usage
Register the bundle and name the Redis server; the cookie stays under framework.session as usual:
// config/bundles.php return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], // ... Artigo\Session\Bundle\RealtimeSessionBundle::class => ['all' => true], ];
# config/packages/framework.yaml framework: session: name: APPSESSID cookie_secure: auto cookie_samesite: lax gc_maxlifetime: 1440 # config/packages/realtime_session.yaml realtime_session: dsn: '%env(SESSION_REDIS_DSN)%' prefix: app-session
That is the whole integration. The bundle puts its own session storage, session factory and session listener in the place of the framework's, so $request->getSession(), the flash bag, the firewall, CSRF tokens, KernelBrowser::loginUser() and the profiler work on it as they are, and no PHP session function is called. With a Redis user that may not load functions, as docs/server.md recommends, load the function library at each deploy with bin/console realtime-session:functions:load, its --dsn naming the user that may.
get(), set(), has(), remove(), all() and the flash bag work as in Symfony; each call goes to Redis. The session is an Artigo\Session\RealtimeSession, which adds five calls:
use Artigo\Session\RealtimeSession; $session = $request->getSession(); \assert($session instanceof RealtimeSession); $session->increment('visits'); // count, in one step $session->append('history', $page, limit: 20); // add to a list, keep the newest 20 $session->update('cart', fn (?array $cart): array => [...$cart ?? [], $item]); $quota = $session->getLocked('quota'); // other requests wait for it ... $session->set('quota', $quota - 1); // ... until it is written or released
A name is an attribute's name, or a path below it, a list of keys one per level: $session->increment(['stats', 'pages']) changes the one number inside stats. A path may go further down: A value deep inside an attribute.
Every option of the bundle, its services and commands, and the set-up without the framework: docs/configuration.md.
Examples
A basket
Each product is a number of its own inside the basket, so two tabs that add different products, or the same one, both count:
$key = 'sku-'.$product->getId(); $session->increment(['basket', $key], $quantity); $basket = $session->get('basket', []); // ['sku-1' => 2, 'sku-7' => 1]
Taking a product out changes the basket as a whole, so it is done under the basket's lock:
$session->update('basket', static function (?array $basket) use ($key): array { unset($basket[$key]); return $basket ?? []; });
A read or a write waits for the locks on its path and on the levels above it: while the basket is locked, every write inside it waits. Taking a lock does not wait for the locks below it, so an update(['basket', $key]) that is running meanwhile writes its product after the basket's closure has written, and can bring back the product just taken out. Use update() on a product and update() on the whole basket side by side only when the basket's closure keeps the products it is not about.
The key is sku- and the product's number, not the bare number: with the keys 0, 1, 2 … the basket reads back as a PHP list, update() writes it back as a JSON list, and a list takes no product of a new number.
A value deep inside an attribute
A path goes as deep as the value sits, and the levels above it are made where they are missing:
$session->update(['checkout', 'shipping', 'address', 'city'], static fn (?string $city): string => 'Vienna'); $session->update(['checkout', 'shipping', 'address', 'zip'], static fn (?string $zip): string => '1010'); $session->increment(['checkout', 'steps', 'edits', 'address']); // 1 $session->append(['checkout', 'steps', 'visited'], 'address', limit: 5); $session->get('checkout'); // ['shipping' => ['address' => ['city' => 'Vienna', 'zip' => '1010']], 'steps' => ['edits' => ['address' => 1], 'visited' => ['address']]]
Each call changes its one value in place, so two requests that change different fields of the same map at once neither wait for each other nor write over each other, and two that change the same field take turns.
update(), increment(), append(), getLocked() and release() take a path. get(), set(), has() and remove() take an attribute's name, as Symfony's interface defines them, so a value deep inside is read through its attribute: $session->get('checkout')['shipping']['address']['city'].
A path goes through maps only. Below a scalar, or into a list by an index, as the basket's bare numbers would make it, a write throws a PathConflictException, changes nothing and gives back the lock update() took. A path and the value written at it nest 127 levels at most (RedisJsonSessionStore::MAX_DEPTH), the attribute bag's own level among them, so a path to a number or a string has 126 keys at most; a deeper write throws an \InvalidArgumentException and writes nothing.
Counters and limits
increment() answers the new number, so the check and the count are one step and two requests cannot both be the fifth:
if (($session->increment('code_attempts') ?? \PHP_INT_MAX) > 5) { throw new TooManyRequestsHttpException(60); }
It answers null when nothing was counted, because the session was ended meanwhile or the request's id change failed; the example refuses then as well.
Recently viewed
$session->append('recently_viewed', $product->getId(), limit: 10);
The list keeps its newest ten entries. Ten requests at once add ten entries; none replaces the list with its own copy.
A value two requests must not change at once
update() locks the value, reads it, hands it to the closure and writes what that returns. A request that wants the same value meanwhile waits for it, for this value only:
$left = $session->update('downloads_left', static fn (?int $left): int => max(0, ($left ?? 3) - 1));
When the work between the read and the write is more than a closure, hold the value yourself:
$step = $session->getLocked('checkout_step'); try { $next = $checkout->advance($step); $session->set('checkout_step', $next); // the write gives the lock back } catch (\Throwable $e) { $session->release('checkout_step'); throw $e; }
A lock that is never given back ends with the request, or after lock.lifetime when the process died. How a waiter waits: docs/locks.md.
Messages for the next page
$this->addFlash('notice', 'Saved.');
Nothing changes in the code. A flash added is appended in one step, and a flash read is taken in one step, so two requests neither lose a message nor show the same one twice.
Login and logout
Nothing changes in the code here either; Symfony's security writes to the session as before.
- A login moves the session to a fresh id. The old id is ended, so a request still running with the old cookie writes nowhere, however long it runs. For five minutes the old id names the new one, so a logout from such a request ends the new id too.
- A logout ends the id, and every id that replaced it during the request, and clears the cookie. A request of that browser that was still running cannot bring the session back, however long it runs.
- A request that arrives with the cookie of an ended id, from a tab that kept the cookie from before a login, or after a logout whose response was lost, starts on a fresh, empty id, as a browser without a cookie does. It is not signed in, never reaches the session that replaced the old id, and what it writes is kept under the fresh id, whose cookie its response sets. A login form loaded that way signs in at the first try.
- A logout sent with a cookie from before a login ends nothing: the browser already holds the newer cookie, which stays signed in.
- A login whose id change is held up between its two steps for longer than
lock.lifetime, while another request of the browser comes with the same cookie, is undone by that request (see How it works). The login then changes the id once more, to another fresh id, and goes on as usual when that goes through. - A login whose id change fails is not signed in.
migrate(true)throws aStoreExceptionwhen Redis refuses the change halfway, on a full server say, when Redis cannot be reached, or when the change is undone a second time. The session stays on its old id with its values; when Redis cannot even be reached to put it back, the next request on that id does. From then on the request stores nothing more in the session but flash messages: what else it writes, and the token Symfony's firewall writes at its end, is not stored, and a warning says so once. A flash message it adds, one that asks the visitor to sign in again say, is stored while the session the browser came with is still there, and shown on the next page; otherwise, for a browser that came without a session or while the session waits to be put back, it is dropped. A flash message that cannot be written, while Redis cannot be reached or the server is full, is dropped and logged as a warning, so the response that tells the visitor still goes out. Storing or taking a flash message renews the session's lifetime, as any write does. A flash bag that is not this package's has its messages dropped, as every bag of another kind does. Keep the message generic: whoever holds the old cookie, which is not signed in, can read it. Reads still answer the stored values, or nothing while the session waits to be put back. The request ends with an error and its response sends no cookie, so the browser keeps its old cookie, which is not signed in, and the visitor signs in again.
$session->isEnded() tells a long request that its session was ended meanwhile. A request that came with an ended id is on a fresh id instead, and isEnded() is false for it. $session->isReadOnly() tells a request that its id change failed and that what it writes is not stored, but flash messages while the browser's own session is still there; a later id change or invalidate() that goes through ends that, and the next request starts without it.
Objects
Nothing is stored serialized by this package and it never calls unserialize(). The one serialized string in a session is Symfony's security token, which Symfony serializes and reads back itself. A value is stored as readable JSON, and an object as a map of its fields. A class of the application says how:
use Artigo\Session\StorableInterface; final class Money implements StorableInterface { public function __construct( public readonly int $amount, public readonly string $currency, ) { } public function toSession(): array { return ['amount' => $this->amount, 'currency' => $this->currency]; } public static function fromSession(array $data): static { // the data comes from the session store: check it as any input if (!\is_int($data['amount'] ?? null) || !\is_string($data['currency'] ?? null)) { throw new \InvalidArgumentException('That is no sum of money.'); } return new self($data['amount'], $data['currency']); } } $session->set('price', new Money(1999, 'EUR'));
Redis holds {"__class": "App\\Money", "amount": 1999, "currency": "EUR"}, and get('price') answers a Money. Dates and enum cases are stored and rebuilt without any help; a class the application does not own gets a converter; a stdClass, an ArrayObject and a JsonSerializable object are stored as their data. Any other object is refused when it is set, with the path where it sits. All of it: docs/values.md.
A stored object is changed as a whole, or one field at a time by path:
$session->update('price', static fn (Money $price): Money => new Money($price->amount + 1, $price->currency)); $session->update(['price', 'amount'], static fn (int $amount): int => $amount + 500); $session->increment(['price', 'amount'], 100); $session->get('price'); // new Money(2600, 'EUR')
As a whole, the change runs under the value's lock and through the class: the closure gets a Money, and the one it returns is stored. A path changes its one field in place without loading the object, so two requests can change different fields of it at once. A write by path goes around the class, though: keep the type the class expects, or fromSession() refuses the data and the value reads back as its map, __class included (Reading back).
Finding sessions
Where is alice signed in? A RediSearch index of the sessions answers, and the server keeps it up to date with every write. The configuration names the fields a search reads:
# config/packages/realtime_session.yaml realtime_session: dsn: '%env(SESSION_REDIS_DSN)%' index: fields: user_id: { path: user_id } last_used: { sortable: true }
user_id reads the attribute of that name, as a tag, a value matched whole; last_used is the time of the session's last write or touch, which the store keeps itself. A field is a tag, a text or a number, and its path may lead into an attribute: docs/search.md.
The index is made at deploy, after the function library and by the same user, with the rights in docs/server.md. It reads the sessions there are, and the command waits until it has:
bin/console realtime-session:index:create --dsn="redis://session-functions:functions-secret@redis:6379"
Symfony keeps the signed-in user in a serialized string, which no search reads, so the application writes the user's identifier at login, on the firewall whose logins keep a session:
use Symfony\Component\EventDispatcher\Attribute\AsEventListener; use Symfony\Component\Security\Http\Event\LoginSuccessEvent; #[AsEventListener(dispatcher: 'security.event_dispatcher.main')] final class StoreUserId { public function __invoke(LoginSuccessEvent $event): void { $event->getRequest()->getSession()->set('user_id', $event->getUser()->getUserIdentifier()); } }
main is the firewall's name. Without dispatcher, Symfony runs a listener of a login on every firewall, a stateless API's too, which signs in on each request: each would start a session. A session signed in before the listener is deployed holds no user_id, so a search by user does not find it until that user signs in again.
On a page behind the admin's firewall, given SessionIndex $index and SessionStoreInterface $store, alice's sessions are counted, listed and ended:
$query = '@user_id:'.SessionIndex::tag($userId); $index->count($query); // 2 $page = $index->search($query, sortBy: 'last_used', ascending: false); $page->hits[0]->attributes['user_id']; // 'alice' while ([] !== $ids = $index->ids($query, limit: 100)) { array_map($store->end(...), $ids); } $index->count($query); // 0
search() and ids() answer one page, 10 hits by default, so the ids are asked for again until none is left: a user signed in on more browsers than one page holds loses them all.
More fields take more kinds of query. With these, a field of the Money of Objects among them:
realtime_session: index: fields: user_id: { path: user_id } name: { path: [profile, name], type: text } amount: { path: [price, amount], type: numeric } visits: { path: visits, type: numeric, sortable: true } last_used: { sortable: true }
and the sessions of alice (Alice Smith, a price of 19.99, 12 visits), bob (Bob Stone, 5.00, 7 visits) and carol (Carol Smith, 1 visit), a query finds by word, by range, by a field of an object, and a page sorted:
$index->count('@name:'.SessionIndex::text('smith')); // 2 $index->count('@amount:'.SessionIndex::range(1000, null)); // 1 $index->count('@visits:'.SessionIndex::range(5, null).' -@user_id:'.SessionIndex::tag('bob')); // 1 $index->count('@last_used:'.SessionIndex::range(time() - 3600, null)); // 3 $page = $index->search('*', limit: 2, offset: 2, sortBy: 'visits', ascending: false); $page->total; // 3 $page->hits[0]->attributes['user_id']; // 'carol' $index->search('@amount:'.SessionIndex::range(1000, null))->hits[0]->attributes['price']->amount; // 1999
Every type of field and query, each with what it finds, runs in examples/find-sessions.php against a server of your own.
- A query is RediSearch's own. Build each part that holds a value with
SessionIndex::tag(),text()orrange(): they escape it, so a value from a request cannot change the query. - A hit carries the session's id. Whoever reads it can take that session over or end it: the page belongs behind the admin, and the ids never go to a log.
- A hit's attributes are what the session reads, objects rebuilt. A write is found at once; an ended session leaves the index at once, an expired one as Redis removes it.
- A session whose id is being changed, at a login say, is found under its old id, for a moment under both; ending either id ends it.
- A session whose value has another type than its field, a number in a tag field say, is left out of the index until the value changes;
realtime-session:index:statuscounts these. - Ending a session signs its browser out, but a remember-me cookie signs it in again; Symfony ends those itself, on a changed password say.
- RediSearch indexes database 0 only. On a Redis Cluster the index covers every node.
- After the fields change, a search fails with a
StoreExceptionnaming the command until the index is made again at deploy.
How it works
A session is one JSON document. Every key of a session carries the id as its hash tag, so on a Redis Cluster a session lives in one slot:
<prefix>:{<id>} the document
<prefix>:{<id>}:ended the mark of an ended id
<prefix>:{<id>}:moving the old document during an id change, kept until the new id has it or the change is undone
<prefix>:{<id>}:lock:<path> a value lock, while held
- Reads and writes are calls of server functions, which the package loads as one function library. A function checks the locks on the value's path, changes the document and renews its lifetime in one step.
- A value lock is a key of its own that expires by itself. A request that finds a value locked listens for the lock's release on a second connection and looks at the lock again each time it wakes; without that connection it polls (docs/locks.md).
- Ids are 32 characters of
[0-9A-Za-z]. An id the store has no session for is not taken over: reads answer nothing and the first write goes to a fresh id. A session never written has no document and no cookie; one whose values were all removed loses its cookie but keeps an empty document until it expires. - An ended id is one a logout or a login ended. A request that arrives with it, that is, the store finds it ended when the session starts, takes it over no more than an unknown id: it starts on a fresh, empty id, and never follows the ended id to the session that replaced it. A session that is ended or expires while a request still runs on it, after that start, is ended for that request: reads answer nothing, writes are dropped and
isEnded()says so. - An id change is two steps, one on each id. When the second fails, the session is put back on the old id, by the change itself or, when Redis cannot be reached for that, by the first request on the old id once the change is older than a lock lives (
lock.lifetime). A request on the old id that comes while the change may still be at work waits: when the change ends meanwhile, it finds the old id ended; when the change has not ended by then, it puts the session back, and the request that changes the id tries once more, to another fresh id. A change that fails, for that reason a second time or for any other, makesmigrate(true)throw aStoreExceptionin the request that changes the id: that request stays on the old id, stores nothing more in the session but flash messages and sends no cookie, so its login is not stored anywhere. A session that got to the new id is never put back, nor one that was ended since; when the old id was ended meanwhile, by a logout in parallel, the request that changes the id goes on with a fresh, empty id. - The server is Redis 8.10 or later with RedisJSON. Each code version calls a library named after its code, so two versions run side by side during a deploy. What the Redis user of an application may and may not do, with the ACL rule to copy: docs/server.md.
Where it differs from Symfony's session
- A value is written when it is set, not when the response goes out, and other requests see it at once.
save()gives back the locks and writes nothing of the attributes or flashes. - An id the store has no session for is not taken over.
loginUser()on a browser whose cookie names such an id writes to a fresh id, while the browser keeps sending its own cookie, so the browser is not signed in. Symfony's test storage takes any id. - A request with the cookie of an id ended before it starts on a fresh, empty id and sends that id's cookie once it writes; an id ended while the request runs keeps the request on it, and its writes are dropped.
- An id is 32 characters of
[0-9A-Za-z].setId()refuses any other with anInvalidArgumentException, and a cookie that holds another counts as no cookie, so a test that sets a session cookie of its own makes one of that form. migrate(true), at a login say, keeps the session's creation time, where Symfony's starts it anew. When the id change fails, it throws aStoreException, the session stays on its old id, and the request stores nothing more in the session but flash messages: Symfony's firewall cannot store the login's token there, no cookie is sent, and the visitor signs in again; a flash message the request added is shown on the next page while the browser's own session is still there, and dropped otherwise. A change that another request of the browser undid, because it was held up for longer thanlock.lifetime, is first tried once more, to another id.- A session started on an id it has is written twice in a request, when it starts and at
save(), each time to renew its lifetime and its last-used time, whatevermetadata_update_thresholdsays; the option has no effect. A request whose id change failed skips the write atsave(). - Symfony's file-based test storage (
storage_factory_id: session.storage.factory.mock_file, which Symfony's recipe sets for the test environment) is replaced by this storage, as the native one is. An application's tests that use the session therefore run on Redis and need a server. Any otherstorage_factory_idstops the container build with anInvalidConfigurationException. - A session bag of the application's own, one that is not this package's, is read when the session starts and written at
save(). An object in it that the store cannot store is refused then, atsave(), with anUnstorableValueException, not when it is put in the bag. - A logout sent with a cookie from before a login sends no cookie at all, where Symfony's clears it: the browser may already hold the newer one.
- Nothing is stored serialized but Symfony's security token, which Symfony serializes itself. An object comes back only when it implements
StorableInterface, a converter handles it, or it is a date or an enum case. AstdClass, anArrayObjectand aJsonSerializableobject are stored as their data and read back as that data, a PHP array for the first two, never as the object. Any other object is refused with anUnstorableValueExceptionwhen it is set. - The error of a failed login is stored by the bundle's converter without its token, its user or fields of the application's own, so
getToken()andgetUser()of the error the login page reads answer null, and an error of the application that cannot be made from the kept fields comes back as the nearest class above it that answers the same message (see What Symfony keeps in the session). A stored error that cannot be rebuilt reads as no error on the login page. - A map that names a class it cannot rebuild reads back as that map, never as an object or a
__PHP_Incomplete_Class. An application's own key__classis stored escaped and reads back as written. - An attribute name, or a key of a path, that begins with a space is refused with an
InvalidArgumentException, since RedisJSON would drop the space. Names with a slash or other characters are stored as they are, the CSRF tokens'_csrf/<id>among them. session:clearis gone, and$_SESSIONand PHP's session functions are not used.
As in Symfony, start() counts as use of the session, and a page whose firewall reads the token without using it stays public.
Requirements
- PHP 8.4.1 or later with phpredis (
ext-redis) 6.1 or later - Symfony 8.2 or later: http-foundation, http-kernel and event-dispatcher; the bundle also needs framework-bundle, and its commands console. The profiler's request panel shows the session's values from Symfony 8.3 on; on 8.2 it shows where the session was used
- Redis 8.10 or later with RedisJSON, a single server or a Redis Cluster; the official Redis 8 images bundle RedisJSON, and the search module that finding sessions needs
- A Redis server for the sessions alone, with
maxmemory-policy noeviction, Redis's default: every key of the package expires, so under any other policy a full server may evict sessions, held locks and the marks of ended ids (see docs/server.md)
CI runs the suite on PHP 8.4, 8.5 and 8.6 against Redis 8.10 and the current 8.x server, and on a Redis Cluster.
Running the tests
REDIS_DSN=redis://127.0.0.1:6379 REDIS_ADMIN_DSN=redis://127.0.0.1:6399 vendor/bin/phpunit --fail-on-skipped --exclude-group cluster --exclude-group symfony-8.3
REDIS_DSN=redis://127.0.0.1:6379 REDIS_CLUSTER_DSN=127.0.0.1:7000,127.0.0.1:7001,127.0.0.1:7002 vendor/bin/phpunit --fail-on-skipped --group cluster
REDIS_DSNis a Redis 8.10 or later server; the tests write keys under prefixes of their own and delete them, and flush nothing. Some delete the function library of this version, which a store loads again at its next call when its user may load functions; do not point the tests at a server whose applications cannot load the library themselves.REDIS_ADMIN_DSNis a server no one else uses: the tests that change its memory limit or its function libraries run there.REDIS_CLUSTER_DSNlists the seeds of a Redis Cluster, for the groupcluster; the application's tests of that group openREDIS_DSNas well.
A test whose server is not set or does not answer is skipped, and so is a test of the session index on a server without the search module or on a database other than 0; --fail-on-skipped makes that a failure. Two tests read the ACL log and skip on a phpredis build that cannot; drop --fail-on-skipped there. The first command leaves out the group symfony-8.3, as CI does on Symfony 8.2, where its tests skip; on Symfony 8.3 or later, drop --exclude-group symfony-8.3 to run them.
Licence
MIT. See LICENSE.



