PHP Reddit – Telegram
PHP Reddit
34 subscribers
289 photos
37 videos
24.8K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
PHP Performance Benchmarking

Hi There,

I'm looking for multiple studies regarding PHP performance in scenarios of CPU model difference of Intel VS AMD

I want to find on which specific scenarios - which would serve better.
Are there any studies conducting such tests to see if there are any actual difference in reality?

https://redd.it/1mxxxfx
@r_php
I've published my first PHP app as a Docker image

I've just published the Docker image I asked some advice about here a few days ago.

https://www.reddit.com/r/PHP/comments/1mq53si/best\_strategies\_to\_distribute\_a\_php\_app\_in\_a/

First of all, I would like to thank all those who commented the post. I received many useful tips which helped me to build the image. So which decisions did I make?

1. No Composer in the image. The Dockerfile runs the Composer commands during the build process, and do not include Composer in the final image. As a result, the image starts very fast, even at the first run.
2. Run Composer in a separate stage, then copy the vendor dir and other useful files to the final image. Another advice received here. I hope this way no unexpected files are included in the image.

What I think I could have done.

1. Use FrankenPHP. It it simpler to setup than Nginx Unit, but it costs an extra 30Mb or more in the final image.
2. Run Composer after the build. I feel a little bit uncomfortable about including the vendor dir in the image. A composer.lock file and the appropriate Composer commands executed in the container entry point provide the same result, without any notable security issue, afaik. Maybe I care too much about the Packagist stats of those open source packages, and not enough about the container immutability.
3. Use a makefile or another tool for advance configuration. It could have made sense for a more complex setup, but the requirements here are simple enough to be tackled with a few cli commands.

The resulting image is available here: https://hub.docker.com/r/lagdo/jaxon-dbadmin, and the Dockerfile is here: https://github.com/lagdo/dbadmin-app/tree/main/docker.

I'll explain what the application is in a next post.

Thanks again for all your contributions.

https://redd.it/1my2rld
@r_php
Laisser la production en mode dev

Bonjour

Je fais ce post suite à un projet communautaire pour un serveur minecraft qui est une plateforme de vente d'objets en symfony.


Lors du passage en production (le premier de toute ma vie), j'ai eu de très nombreux problèmes notamment liés au mapping et au versioning des images.

Depuis, même après 6 heures de debug le problème est le suivant:

Si le projet est en mode dev, aucune erreur et les couleurs custom de tailwind sont bien appliquées.

si le projet est en mode prod, les images ne chargent plus et les couleurs de tailwind sont toutes remplacées par un bleu clair par défaut.

Quels sont les risques à laisser l'application en mode dev même pour les utilisateurs? Il n'y a aucune donnée sensible ni aucune manipulation d'argent, donc j'hésite vraiment à utiliser cette solution bien qu'elle relève de la facilité.

Je suis à l'écoute de vos solutions / avis

https://redd.it/1my4g7a
@r_php
Q: Import One Million Rows To The Database - 2?

Inspired by this video:
[https://www.youtube.com/watch?v=CAi4WEKOT4A](https://www.youtube.com/watch?v=CAi4WEKOT4A)

A *“friend of mine”* is working on a project that needs a robust solution for importing and syncing millions of rows across many users. The app is a marketing tool that syncs thousands of contacts from multiple external sources into a user’s address book. The system needs to:

* Fetch newly available contacts
* Update existing ones
* Remove contacts deleted from the original source

Ideally, all this should happen with minimal delay. The challenge grows as more users join, since the volume of operations increases significantly.

Right now, my *“friend”* is considering a recurring job to pull contacts and update them locally, but there are many open questions about scalability, efficiency, and best practices.

If you know of any resources, design patterns, or approaches that could help build an elegant and efficient solution, please share!

Thanks!

https://redd.it/1mya6cl
@r_php
Boosting Laravel Boost

Laravel dropped a new package "Laravel Boost". It makes AI suck less by giving it a bunch of tools to better understand your app, and it's great. But I think we can give it an extra boost.



https://blog.oussama-mater.tech/laravel-boost/

https://redd.it/1myb0d2
@r_php
Boosting Laravel Boost

Laravel dropped a new package "Laravel Boost". It makes AI suck less by giving it a bunch of tools to better understand your app, and it's great. But I think we can give it an extra boost.

https://blog.oussama-mater.tech/laravel-boost/

https://redd.it/1myb5s0
@r_php
New: Beam — Use Laravel Pennant Feature Flags in JS/React/Vue

Hey everyone! 👋

I just launched [Beam](https://beam.beacon-hq.dev), a small JavaScript + Laravel library that brings Laravel Pennant feature flags to your frontend (think: Laravel Echo but for Pennant).

Whether you’re building in React, Vue, or even vanilla JS, Beam gives you:

* Use your Pennant flags in the browser
* 🔁 A simple API to update your UI in real-time
* 🎯 Simple setup that feels Laravel-native

This isn’t a backend feature flagging tool — it’s purely for consuming Pennant flags from your frontend (works great with tools like Inertia too).

import { useFeatureFlag } from '@beacon-hq/beam/react';

function Component() {
const { status, value, loading } = useFeatureFlag<string>('experiment', {
defaultValue: 'control'
});

return (
<div>
{loading && <span>Loading…</span>}
{!loading && <div>{status ? `Variant: ${value}` : 'Feature Off'}</div>}
</div>
);
}

📦 Full docs & setup: [https://beam.beacon-hq.dev](https://beam.beacon-hq.dev)

It’s open source and in early beta — feedback welcome!

https://redd.it/1myjw4c
@r_php
Lost in the middle of frontend packages

I'm currently learning Symfony after years of working with Laminas. While the transition is relatively straightforward on the backend side, I'm completely lost on the frontend. Between Symfony UX/stimulus/hinclude.js/turbo/live components

I feel like I've come across a myriad of different frontend packages in the documentation without really understanding the specific purpose of each.

Do you use a lot of frontend packages in your Symfony projects? If so, which ones and why? And if you have any advice to better understand all this, I'd be happy to take it

https://redd.it/1myq0qm
@r_php
Type Safe Config Generator Implementation

Hi guys, so while reading the article Creating type-safe config classes : r/laravel by Luke Kuzmish posted yesterday, the comment here by u/sribb https://www.reddit.com/r/laravel/comments/1my1464/comment/na8uktj and a great deal of boredom, I decided to attempt to create a Type Safe Config Generator. Check out the implementation here (https://gist.github.com/Horlerdipo/d6350fe97b19754bb5bcee9c87739b14) and roast me (jk jk).
What do you think?
What would you do differently?

I plan to attempt adding type annotations for generated array types as PHPstan would start screaming at the classes that would be generated with this.

https://redd.it/1myv053
@r_php
Weekly /r/Laravel Help Thread

Ask your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips:

What steps have you taken so far?
What have you tried from the documentation?
Did you provide any error messages you are getting?
Are you able to provide instructions to replicate the issue?
Did you provide a code example?
Please don't post a screenshot of your code. Use the code block in the Reddit text editor and ensure it's formatted correctly.

For more immediate support, you can ask in the official Laravel Discord.

Thanks and welcome to the r/Laravel community!

https://redd.it/1mz10v3
@r_php
Issue with Webhook Signature Verification when Request Body Contains Arabic Characters

Hello,
I’m implementing webhook signature verification for Loyverse in PHP. The verification works correctly when the request body contains only English characters.

However, when the payload includes Arabic characters, the generated signature does not match the X-Loyverse-Signature header, and the verification fails.

Here’s the relevant code snippet:

 protected function verifySignature($headers) {
$rawBody = filegetcontents('php://input');
if (empty($headers'X-Loyverse-Signature')) {
return false;
}
$signatureHeader = $headers'X-Loyverse-Signature';
$computedSignature = hashhmac('sha1', $rawBody, $this->appSecret);
return hash
equals($computedSignature, $signatureHeader);
}



Any help or pointers would be hugely appreciated

Docs https://developer.loyverse.com/docs/#section/Webhooks-overview/Adding-webhook

https://redd.it/1mz1v8f
@r_php
Why isn’t PHP more popular?

Hey, i'm a pretty new dev (generally and even more at php specifically). I've first worked with bare php for a web dev class at uni and thought the language was pretty cool, coming from C. Now I'm learning Symfony at work so i'm practicing the oop aspect of php, and it seems that this is a very powerful language?

Title is a bit clickbait as i know php is still very popular in backend, but i'm wondering why isn’t it more recommended as a general programming language? Like in software dev or game dev, where it seems Java and C++/C# dominate the industry

Am I missing something? (performance issues? or maybe i'm just not aware of the actual popularity of php?)

https://redd.it/1mz5ch5
@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/1mzfoxx
@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/1mzim12
@r_php