Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Utf8 React Laravel Package

clue/utf8-react

Streaming UTF-8 parser for ReactPHP streams. Wraps a ReadableStream to ensure emitted chunks contain only complete, valid UTF-8 sequences, buffering split multibyte characters and replacing invalid bytes with a configurable placeholder.

View on GitHub
Deep Wiki
Context7

Streaming UTF-8 parser, built on top of ReactPHP

Frequently asked questions about Utf8 React
Can I use clue/utf8-react for Laravel WebSocket streams (e.g., Pusher, Ratchet, or Laravel Echo)?
No, this package is not designed for Laravel. It requires a full ReactPHP event loop, which conflicts with Laravel’s synchronous HTTP kernel. For WebSocket UTF-8 handling, consider ReactPHP’s native solutions or middleware like `beberlei/ratchet` with custom stream wrappers.
How do I install clue/utf8-react in a Laravel project?
Run `composer require clue/utf8-react`—but integration is non-trivial. The package lacks Laravel service providers or middleware, so you’d need to manually bridge ReactPHP streams to Laravel’s Request/Response objects, which isn’t officially supported.
Does clue/utf8-react work with Laravel Octane (ReactPHP/Swoole)?
No, even in Octane, this package won’t integrate natively. Octane’s ReactPHP layer is for HTTP, not raw stream processing. You’d need to rewrite Laravel’s routing, sessions, and ORM to work with ReactPHP’s event loop—effectively abandoning Laravel’s core.
Is there a simpler alternative to clue/utf8-react for UTF-8 validation in Laravel?
Yes. For most Laravel use cases, PHP’s built-in `mbstring` functions or `symfony/polyfill-mbstring` suffice. If you’re processing streams (e.g., file uploads), use `mb_check_encoding()` or `mb_convert_encoding()` instead of a ReactPHP dependency.
Will clue/utf8-react break my Laravel application if I install it?
Not directly, but it’s useless without a ReactPHP server (e.g., `reactphp/http`). Installing it won’t harm Laravel, but it won’t help either—unless you’re building a separate ReactPHP microservice for stream processing, which requires significant architectural changes.
Can I use clue/utf8-react for real-time APIs or WebSocket UTF-8 validation in Laravel?
No. Laravel’s synchronous architecture (controllers, middleware, Eloquent) can’t coexist with ReactPHP’s event loop. For real-time APIs, use Laravel’s built-in WebSocket support (e.g., `beyondcode/laravel-websockets`) or a dedicated ReactPHP service behind a reverse proxy.
How do I configure clue/utf8-react to replace invalid UTF-8 bytes with a custom placeholder?
Pass the placeholder as the second argument to `new Sequencer($stream, 'X')`. For example, `$stream = new Sequencer($stdin, '⚠️')` replaces invalid bytes with a warning symbol. This works in ReactPHP contexts only—Laravel integration requires additional bridging logic.
Are there Laravel packages that provide similar UTF-8 stream handling?
No. Laravel’s ecosystem lacks stream-focused UTF-8 parsers because its architecture relies on synchronous I/O. For file/stream processing, use `spatie/array-to-xml` (for XML) or Laravel’s native `Storage` facade with `mbstring` validation instead of ReactPHP.
Does clue/utf8-react support PHP 8.3, and will it ever work with Laravel?
Yes, it supports PHP 8.3, but Laravel compatibility remains impossible. The package’s ReactPHP dependency conflicts with Laravel’s HTTP kernel. Even with PHP 8.3 features, you’d need to rewrite Laravel’s core (routing, sessions, ORM) to use ReactPHP.
What are the risks of using clue/utf8-react in a Laravel project?
High. Risks include blocking/non-blocking conflicts (Laravel expects synchronous I/O), resource leaks from manual stream management, and data corruption if streams are interrupted mid-processing. The package’s design assumes a ReactPHP-only environment, which Laravel cannot provide.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
croct/coding-standard
croct/plug-php
nqxcode/phpmorphy
boundwize/pyrameter
testo/facade
headercat/phpstan-extension-ide-helper
yosymfony/parser-utils
innmind/black-box
babenkoivan/elastic-migrations
babenkoivan/elastic-adapter
develia/commons
dmstr/symfony-system-resources-bundle
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
renatomarinho/laravel-page-speed
develia/geo-bundle
austinheap/laravel-database-encryption
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle