# What's Up with ReactPHP When I first heard of [ReactPHP](https://reactphp.org) a few years ago, it looked very promising. Providing timers, asynchronous processing, streams, and sockets, all within PHP. \ However, in recent years, there seems to be stagnation. While you see commits, you seldom see any publication. \ [Framework X](https://framework-x.org) is an attempt to make ReactPHP into a micro framework, but I see little mention of it. \ Overall, whenever I tried using ReactPHP, I found that it is better to use [Laravel](https://laravel.com) and its rich ecosystem. # Streaming with ReactPHP [Building Video Streaming Server with ReactPHP](https://sergeyzhuk.me/2017/07/17/reatcphp-http-server/) was a nice approach to building a streaming server with ReactPHP, which I could not see how to do as simple in Laravel. \ A recent article [Streaming ReactPHP in ReactJS](https://agiroloki.medium.com/streaming-reactphp-in-reactjs-2cda05de3b73) revived the topic and showed how you integrate with [React](https://reactjs.org). \ This got me thinking about how far you can go with ReactPHP in terms of streaming. # A Media Server Design A media server has three components: \ 1. Streaming of media files 2. Web interface to select files, login users, and control playback. 3. A backend to manage files and users \ While ReactPHP is very good for the streaming part, web application programming with ReactPHP is not common and lacks an ecosystem of build tools and libraries. \ This is especially apparent if you want to build a dynamic modern interface, as you do nowadays with a Single Page Application (SPA). \ So it would seem natural to wrap the ReactPHP in a Laravel application. Laravel is well suited for managing files, including file upload, and has built-in user management. \ The web interface will be built by either some SPA framework such as React or [Vue](https://vuejs.org), or alternatively, [Laravel Livewire](https://laravel-livewire.com) with [AlpineJS](https://alpinejs.dev). # Uploading and Storing Video Files [Laravel Media Library](https://spatie.be/docs/laravel-medialibrary/v10/introduction) associates media, such as video files, to your models. \ The library integrates FFMpeg through the [PHP-FFMPEG](https://github.com/PHP-FFMpeg/PHP-FFMpeg) so that you can create thumbnails of videos. Moreover, using PHP-FFMPEG, you can do all common transcoding of videos. # Validating Video Files Standard Laravel validation rules handle video file size and type. \ However, a media server needs a more targeted validation of videos, such as duration, codec, and dimensions. \ [Laravel Audio & Video Validator](https://github.com/minuteoflaravel/laravel-audio-video-validator) supplies these extra validations based on FFMpeg. \ Possibly, we would need to fork and extend their code to support additional validations, such as frame rate and bitrate. \ ***Also published [here](https://yoramkornatzky.com/post/media-streaming-with-reactphp).***