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
Post reactions management and storage

Hi everyone,

For a cms solution, how to manage reactions on a post ? (Like, dislike, love, etc) in a scalable way ? Since each reaction is at a least write query then an update to a counter etc.

What database ? Or queue system do i need to manage it effectively?

https://redd.it/1ks3lrj
@r_php
I made a ORM named LiliDb taking advantage of Php modern features

Hello everyone at Php community, this post is a self-promotion for something I had made because I didn't like another ORM for Php (Doesn't uses Php modern features) and it will be awesome if somebody gives a try and make a feedback 😄

https://github.com/sebastianguzmanmorla/LiliDb

https://packagist.org/packages/sebastianguzmanmorla/lili-db

https://redd.it/1ksi8hg
@r_php
RANT: Can't Really Understand The JS Fanatics

They say in JS you can do front-end, back-end as well as mobile apps if needed all in JS. Is it really?

For every single thing, you need to learn something from the ground up. React's architecture and coding style is completely different than how Express works. I know I am comparing apples to oranges by comparing front end to back end. But the architecture do change right, unlike what JS fanatics claim that you can do it all in JS. They change so much that they feel like these frameworks are completely a different language. Where is the same JS here except for basic statements?

If they can understand to do so many different frameworks within JS, they might as well learn a new language as everything changes completely within JS from framework to framework.

https://redd.it/1kskbzf
@r_php
Prevent "out of memory" when I want list of many files

I have many many files at one folder, around 500.000 files. I want to list them, but server has not many memory to list all of files. Is there a way to list all files step by step by paging?

https://redd.it/1kskvxj
@r_php
Why are twig variables supposed to be snakedcase

Twig recommends to name variables in snake
case but why would camelCase not make more sense because every PHP variable is camelCase? Also camelCase looks much nicer for variables.

There are also big Symfony projects like Shopware that use camelCase for twig variable names.

https://redd.it/1ksw7lg
@r_php
I built Larabuild — a v0.dev-inspired tool for generating Laravel Blade components with Tailwind and live previews

Hey all 👋

I've been working on a little tool called Larabuild — heavily inspired by v0.dev, but tailored specifically for Laravel devs who love Blade and Tailwind.

The idea is simple:
You type what you want (“a hero section with a video background and call to action”), and it gives you clean, previewable Blade + Tailwind v4 components — using props, projects, and your design system context.

Right now:

You get 50 prompts to play with
It supports projects, Live previews, and prop-driven components
It's very much in alpha — things might break, but the core works
I’d love your feedback before polishing and building further

🔗 https://larabuild.com

If you're into Laravel, Tailwind, or tools like v0.dev — I’d love to hear what you think or what you'd want added next.

Thanks!
—Elliott

https://redd.it/1kszg6k
@r_php
Optimizing MySQL queries in PHP apps

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 SQL query optimization in your workflow?








https://redd.it/1kt0zh1
@r_php
🪨 Granite 1.0.0 is here!

Just released Granite, a lightweight PHP library that makes building type-safe, immutable DTOs and Value Objects a breeze.

Granite is a zero-dependency PHP 8.3+ library for creating immutable objects with validation.

**Main features:**

* **Zero dependencies** \- Pure PHP 8.3+
* **Attribute-based validation** \- Use PHP 8 attributes right on your properties
* **Immutable by design** \- All objects are read-only and type-safe
* **Smart serialization** \- Control property names and hide sensitive data
* **Auto type conversion** \- DateTime, Enums, nested objects just work
* **Built-in AutoMapper** \- Map between different object structures effortlessly
* **Performance optimized** \- Reflection caching under the hood

Perfect for APIs, domain models, and anywhere you need bulletproof data objects.

**Install:** `composer require diego-ninja/granite`
**Repo:** [https://github.com/diego-ninja/granite](https://github.com/diego-ninja/granite)

Comments, ideas, and collaborations are always welcome. [](https://github.com/diego-ninja/granite)

https://redd.it/1kt2w57
@r_php
PHPUnit website redesign: a new look for a historic tool

Hi PHP devs,

I'm currently working on redesigning PHPUnit's official website. A must for our projects, but let's face it: its site was no longer up to scratch.

* Modernized interface
* Revamped user experience
* Landing page generated with the help of AI to test a faster, iterative and responsive approach

The main content (the doc) is now elsewhere, so we had to rethink the very function of the site: inform, orient, reassure.

👉 New site : [https://phpunit-restyle-project.lovable.app/](https://phpunit-restyle-project.lovable.app/)

Your feedback is welcome: bugs, suggestions, or even harsh criticism. I'll take it all!

https://redd.it/1ktebpk
@r_php
Psalm Plugin for Markdown Reports

Hai PHP devs,

just released a small plugin for psalm, that creates a Markdown report.
I am using it to pusblish reports as pull request comments on github. See an example output

Maybe someone finds it useful too...

bye

https://redd.it/1ktx5m1
@r_php
Is MySQL Future-Proof for Laravel Projects

I've had a long relationship with MySQL, It's my favorite database but it doesn't seem to be evolving fast enough.

Recently, I was asked to add semantic search to a legacy Laravel e-commerce project. The project is built as a large monolith with numerous queries, including many raw SQL statements, and it uses MySQL with read/write replicas.

During my research, I found that MySQL doesn't natively support vector search, which is essential for implementing semantic search. This left me with the following options:

* **Store embeddings as JSON (or serialized format) in MySQL and implement the functionality in PHP **: This would involve pulling all relevant DB records and iterating over them in memory. It's likely not a viable option due to performance and memory concerns.
* **Migrate the database to a vector-search-compatible DB like PostgreSQL **: This is risky. The lack of comprehensive test coverage, the presence of many raw queries (which might need syntax changes), and the overall complexity of the current architecture make this a difficult path.
* **Use an external vector database like Qdrant specifically for semantic search **: This is probably the safest and most modular solution, though it comes with additional infrastructure and cost considerations.

I couldn't find a perfect solution for the current system, but if it were already using PostgreSQL, adopting semantic search would have been much easier.

So Should we consider PostgreSQL over MySQL for future projects (may not relevant to small projects), especially considering future needs like semantic search Or am I overlooking a better alternative



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