PHP Reddit
31 subscribers
308 photos
40 videos
25.3K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Olá, estou desenvolvendo essa API. Gostaria que avaliassem e me desse uma senioridade de acordo com o código e se me contratariam ou não, obrigado.

Link repo: https://github.com/kakabraga/laravel-api

https://redd.it/1sjuy8u
@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/1sjz2v2
@r_php
PHP app showing corrupted numeric values (e.g. 262145100 instead of 100) on server but works locally

Hey everyone,

I’m stuck with a weird issue in my PHP + MySQL project.

Problem: On localhost everything works fine. But on live server, numeric values (wallet amounts) get corrupted.

Example: Expected: 100 Actual: 262145100

Details:

* Core PHP (no framework)
* MySQL database
* Razorpay payment integration
* Same codebase used locally and on server
* Database values were getting stored incorrectly earlier (possibly due to wrong amount conversion)

What I’ve checked:

* PHP version & extensions (all good)
* Output buffering / encoding
* Session handling
* API responses

Current suspicion:

* Some kind of data corruption during amount conversion OR earlier stored bad data affecting calculations

Has anyone faced something like this? Could it be:

* Encoding / binary issue?
* Incorrect multiplication (paise conversion)?
* Hidden characters or output buffer corruption?

Any help would be really appreciated 🙏

https://redd.it/1sk3tl6
@r_php
How to use different schemas with Doctrine / where to find information?

I have difficulties finding information on how to handle schemas with Symfony and Doctrine. I know I can set the Database schema with:

#ORM\Table(name: 'table_name', schema: 'schema_name')

But setting the schema for every table seems "not optimal"? There has to be a more general approach, right? Also why can I not find any information about schema handling with doctrine? Do you all just use the default schema for every table? That cant be right.

FYI, I want to use/learn Postgres, but I read that using the public schema can be a security issue. Also I want to just split the prod tables and audit tables. Thats why I wanted to use multiple schemas.

So I come to you, Symfony gods, please help me on the way to enlightment.

https://redd.it/1sk4kfs
@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/1sk28zm
@r_php
Named Arguments Make PHP More Readable and a Refactoring Nightmare at the Same Time

Ever since named arguments landed in PHP 8.0, I've gone back and forth on whether they're actually a net positive.

On one hand, this is genuinely nicer to read:

createUser(
name: 'John',
email: '[email protected]',
role: 'admin'
);


On the other hand, the moment you rename that parameter, even inside a private method, something somewhere breaks. And good luck catching it without full test coverage.

The problem is that parameter names were never part of the contract before. They were implementation details. Named arguments quietly promoted them to public API, and most codebases were not ready for that.

It gets worse in teams. One developer uses named arguments everywhere for readability. Another avoids them entirely. Now your codebase is inconsistent and every PR review turns into an argument about it.

I still use them, but only at the call site of functions I do not own like built-ins and third-party libraries. For my own code that is deployed in prod, I have mostly stopped.

So where do you actually draw the line?

https://redd.it/1skchzn
@r_php
I built an open source WebSocket server in Go that's Pusher-compatible — self-host free forever, or use the managed cloud tier

Hey r/laravel,

I've been building Relay — an open source WebSocket server written in Go that's fully Pusher-compatible. I wanted to share it here because it solves a real problem I kept running into.

The problem: Reverb is great if you're on a pure Laravel monolith. But if your team runs Laravel + Next.js, or Laravel + a Node worker, or anything outside a single Laravel app — Reverb can't serve the non-Laravel parts. Relay can.

What Relay is:

Single Go binary, no runtime dependencies
Fully Pusher-protocol compatible — swap credentials, no code changes
Works with Laravel, Next.js, Rails, Django, Node, and any other language with a Pusher SDK
Multi-app support — one server, multiple projects
Built-in Channel Inspector — live view of active channels and event payloads
Self-host free forever on a $5 VPS

The managed cloud tier (Relay Cloud) is optional. Free hobby plan, $19/mo Startup, $49/mo Business. If you outgrow it, move to self-hosting with two env var changes. Same binary, no code changes.

First-party Laravel package:

bash

composer require darknautica/relay-cloud-laravel

Two env vars and broadcasting works. No config/broadcasting.php editing required.

Performance: At 1,000 concurrent connections, Relay used \~18% CPU and 38MB RAM. Reverb used \~95% CPU and 63MB RAM on equivalent hardware. Full benchmark post here: https://relaycloud.dev/blog/relay-vs-reverb-benchmark

Links:

Site + managed cloud: [https://relaycloud.dev](https://relaycloud.dev)
Open source server: https://github.com/DarkNautica/Relay
Laravel package: [https://packagist.org/packages/darknautica/relay-cloud-laravel](https://packagist.org/packages/darknautica/relay-cloud-laravel)
Docs: https://relaycloud.dev/docs

Happy to answer any questions. Would love feedback from anyone who tries it.

https://redd.it/1skfytz
@r_php
VSCode Intelephense with Workspaces?

It's lowkey killing me that VSCode Intelephense doesn't recognize libraries in the same workspace. Does anyone have a workaround for this?

One alternative is that I can have the library in the IncludePath, but that changes per project even if the library doesn't so it's annoying to have to keep adding the same library while removing the old library so when I jumpto it goes to the one in my active workspace.

Any ideas or workarounds?

https://redd.it/1skkzdk
@r_php
Laravel Privacy Agent Skills (feedback is welcome!)

Hey guys, I’ve been working for the past few months on an app in the healthcare industry that requires strong compliance with user data protection and retention policies.

I recently went to Tropical Rails in Sao Paulo and I attended Talysson Oliveira’s talk, "Privacy on Rails - pragmatically complying to data protection laws". They built an Agent Skill for their privacy-by-design approach to help Rails developers ensure their DX is aligned with these policies from the conception of a Rails app.

However, the app I’ve been working on is built with Laravel, and I thought it would be a great idea to take what they built for Rails and apply a similar concept to Laravel. That’s why I decided to create https://github.com/sairojgg/laravel-privacy-skills as a Laravel alternative.

This is my first time sharing something publicly, let alone an Agent Skill, so any feedback is more than welcome.

This project is heavily inspired by their work, and I want to give full credit to the original creators.

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