Posts tagged with stream

Creating custom stream filters in PHP

In this post we will see how to create a custom stream filter. Streams, first introduced in PHP 4.3, provide an abstration layer for file access. A number of different resources besides files – like network connections, compression protocols etc. can be regarded as “streams” of data which can be serially read and written to.

https://www.codediesel.com/php/creating-custom-stream-filters/

Read more

Upload large files to S3 using Laravel 5 original

by Freek Van der Herten – 1 minute read

Chris Blackwell yesterday published a tutorial on how to upload files to S3 using Laravel. This is the code he used (slightly redacted): $disk= Storage::disk('s3'); $disk->put($targetFile, file_get_contents($sourceFile)); This is a good way to go about it for small files. You should note…

Read more

Join 9,500+ smart developers

Every month I share what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

Displaying stream progress in PHP

Hannes Van de Vreken has written a tutorial on how to display stream progress in PHP.

Opposite to HTTP requests, tasks run from the command line aren’t supposed to return instantly. They can take a very long time. Imagine a task that loops an entire database table or a task that references an external source repetitively, or maybe a taks that performs a large file transfer. It’s very important to show the issuer what is actually going on, or he/she will be left in the dark for minutes/hours. "Is this task still running?", "How long has this thing been running yet?", "Is it almost done?", "Is it running out of memory?"
https://hannesvdvreken.com/2015/05/12/stream-progress/

Read more