PHP Reddit – Telegram
PHP Reddit
34 subscribers
291 photos
37 videos
24.9K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Splitting Horizon Processes across multiple servers?

Hi folks!

I have a small web app that runs on a tiny Hetzner server and having just checked the CPU, it was pinned at 100% and with a lot of jobs left in the queue, that's a problem. (4 processes currently)

I want to take this as an opportunity to learn about splitting up Horizon so that it can effectively spread the jobs across multiple servers at once.

I'm using Ploi, and there's a server option called "Worker server" but I'm a little bit confused about why it requires a second instance of my application to run. I understand the worker server needs access to the first server's Redis.

My jobs are IO bound and they make HTTP requests. I was tempted to upgrade the server's resources but I know I'd eventually run into rate limiting if all the jobs are being processed on one machine.

This is a concept I've always found interesting, but I've always struggled to wrap my head around how to configure something like this. I imagine it's mostly straightforward once you've done it once.

https://redd.it/1kvavoc
@r_php
Multiple Horizon Instances?

Does anyone have experience running multiple Horizon servers? I'm curious what complexities and/or limitations you run into.

Just to be clear, I'm not talking about separating web and queue servers, this is a step beyond that.

I'm curious about intentionally single-threaded queues, cross-instance job locking, and generalized scalability of multiple horizon instances.

What have your guys' experience been?

https://redd.it/1kvgzte
@r_php
Weekly Ask Anything Thread

Feel free to ask any questions you think may not warrant a post. Asking for help here is also fine.

https://redd.it/1kvk9zp
@r_php
Weekly help thread

Hey there!

This subreddit isn't meant for help threads, though there's one exception to the rule: in this thread you can ask anything you want PHP related, someone will probably be able to help you out!

https://redd.it/1kvn2q8
@r_php
Optimized PHP Images for Laravel

# 🚀 Optimized PHP Images for Laravel! 🐳

Hey Laravel devs! I’ve built PHP-Optimized Docker Images for Laravel 10-12, hosted on GHCR (ghcr.io/redfieldchristabel/laravel). 🐘 These images are fine-tuned for performance, security (non-root laravel user), and follow Docker best practices (one process per container, stdout logs). Includes pre-installed PHP extensions and a scaffolding noscript for easy setup! 😄

laravel container registry

https://redd.it/1kvy6me
@r_php
Send a WhatsApp Message with Just a 3 Lines of PHP

**Send WhatsApp Messages with Just 3 Lines of PHP (No Twilio, No Complexity)**

If you're a PHP dev and want to send WhatsApp messages effortlessly, this is probably the cleanest way to do it.

All it takes is 3 lines (once Guzzle is installed):

phpCopyEdit$client = new \GuzzleHttp\Client();
$response = $client->post('https://www.wasenderapi.com/api/send-message', [
'headers' => ['Authorization' => 'Bearer YOUR_API_KEY', 'Content-Type' => 'application/json'],
'json' => ['to' => '+1234567890', 'text' => 'Hello, here is your update.']
]);
echo $response->getBody();


* No SDKs
* No bloated libraries
* Just drop it into any Laravel, Symfony, or plain PHP project

https://redd.it/1kw175a
@r_php
Symfony/Doctrine Randomly Deleting Data

I'm very new to symfony/doctrine so I'm probably doing something stupid. Sometimes (seemingly at random) data just disappears from my mysql database. Does anyone have any idea what might be happening?

Maybe I'm using the entity manager interface incorrectly? Most of the time everything works fine.

https://redd.it/1kw2ytg
@r_php
Optimizing MySQL queries in Symfony apps

Hi Symfony developers,

Vlad Mihalcea shared some interesting findings after running the Spring PetClinic app under load and analyzing query performance.

The tool he used flagged high-latency queries, suggested index changes, helped reduce resource usage and improve query performance.

Link if you want to skim: https://vladmihalcea.com/mysql-query-optimization-releem/

Just curious - anyone here use tools for automatic identification and optimization of inefficient SQL queries in your workflow?

https://redd.it/1kw4wwb
@r_php
Made something cool, HTML5 truncation library called chophper

Built this a while back and we use it in some WordPress plugins at scale. It has handled all the dynamic content thrown at it in the wild world of WP, felt like it might be useful to others as well as a general PHP tool.

Feel free to trash it if its dumb, but it only has 1 dependency, and no real PHP minimum requirements like others did.

https://github.com/code-atlantic/chophper

Truncate chars, optionally respecting word boundaries
Truncate words, optionally respecting sentence boundaries
Truncate sentences, optionally respecting block boundaries
Truncate blocks (paragraphs, lists, etc.)
Preserving HTML tags
Preserving HTML entities

​

// Full is built to fully support HTML5 without breaking the HTML structure.
use Chophper\Full as Chophper;

$options
// ... see options below.
;

Chophper::truncate($html, $length, $options);

https://redd.it/1kw5s4g
@r_php
PHPVerse 2025 afterparty 🎉 (Amsterdam)

Hey folks,

If you’re in or near Amsterdam, NL, mark your calendar for Tuesday, June 17!

Right after the PHPVerse 2025 conference, we’re hosting a special edition of the AmsterdamPHP meetup, featuring some of the speakers from the event, including:

Nils Adermann (Co-founder, Packagist)
Nicolas Grekas (Core Developer, Symfony) …and more to be announced.

We’ll have a short talk, a panel discussion on the past and future of PHP, and plenty of time to chat over 🍕 pizza.

📍 Location: Café Restaurant Dauphine, Amsterdam
🕒 Time: Doors open 18:30, talks start 19:30
🎟️ Free event – open to everyone

RSVP here:
👉 https://www.meetup.com/amsterdamphp/events/307306474/

If you’re around for the conference, or just in town and into PHP, come hang out. And feel free to share the link with anyone who might be interested.

We're all very much looking forward to meeting other people in the PHP community :)

Hope to see some of you there!

https://redd.it/1kwjmro
@r_php
I built Laravel AI Factory a package for generating realistic test data using AI models

Hello guys, I've had this thought that it would be quite cool to be able to create test data using AI, instead of plain Faker which Laravel provides. So I created a package for this called laravel-ai-factory, you can check it out on https://github.com/fdomgjoni99/laravel-ai-factory .

I’d love to hear your thoughts and what you think should be added next!

https://redd.it/1kwspwo
@r_php