PHP Reddit – Telegram
PHP Reddit
34 subscribers
288 photos
36 videos
24.8K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Is AI actually helpful in PHP coding if the generated code doesn’t match exactly what we need?

I’ve been experimenting with AI tools for PHP development. Sometimes the AI-written code looks correct but doesn’t work as expected or needs heavy tweaking.

Has anyone here found consistent ways to make AI output more accurate for real-world PHP projects?

https://redd.it/1oj1sd8
@r_php
Is it a common practice to import first a db dump and then run migrations?

In a Symfony project I am trying to introduce migrations with its history. I tried to create migration from scratch like this:

#! /bin/bash

SCRIPTPATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"

git checkout master
git pull origin master

git branch -d task/QDS-5421-introduce-migrations
git checkout task/QDS-5421-introduce-migrations

# Remove all migrations
cp -r ./migrations ./migrations.orig

# Recreater DB
php bin/console doctrine:database:drop --force
php bin/console doctrine:database:create

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

# Create migration that populates initial data
php bin/console doctrine:migrations:generate

# Populate generated migration with data

# Introducer staging changes
git checkout test
git pull origin test
git checkout task/QDS-5421-introduce-migrations
git merge test

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

bash ${SCRIPTPATH}/import_test.sh

# Tool to modify migration's SQL in rder to avoid migration breaking

# Introduce dev changes

git checkout development
git pull origin development
git checkout task/introduce_migrations
git merge development

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

git add .
git commit -m "Renew Migrations"


Then I would version the nessesary migrations via:

php bin/console doctrine:migrations:version


But I find it impractical because:

1. If I try to run them upon actual Db creation of constraints fail upon creation or removal.
2. During work I would get interrupted via various tasks, thereforeit is impractical to re-write history, not to mention that this task has the lowest (as usual) priority.
3. Coleagues continue to add migrations like this:
     php bin/migrations doctrine:migrations:diff

Then manuallt open the generated migration file and run the gnerated sql by hand during deployment. Afterwards they commit the file.

So I am looking a way to reintroduce them. In order to do this I thought top initiaqlize the db migrations like this:

1. Remove any existing migrations
2. Import staging Dump
3. Generate a migration like this:
    php bin/migrations doctrine:migrations:diff

It is a practical approach though. Do you usually import an initial dump and then run migrations upon upon actual production systems as well?

https://redd.it/1oj9u3i
@r_php
My little laravel built tool is live on product hunt

Hi today mi litle tool, an api for random images is live on product hunt, it is built with laravel and allows to recover a random image. You can use it in many ways, inside server side or just inside a html img tag.
Product hunt link.
https://www.producthunt.com/posts/random-images-api

https://redd.it/1ojumbi
@r_php
Getting Business Support for Refactoring — How Do You Do It?

Convincing stakeholders to invest in refactoring is still one of the hardest parts of working with mature PHP systems. You see the slowdown, the bugs, the time we lose fighting legacy code — but the business sees "you want to rewrite something that already works."

I usually try to tie refactoring to clear business outcomes (faster delivery, reduced incidents, unblocking features), and sometimes do a tiny proof-of-concept first — just enough to show the impact instead of arguing about it. Even then, it's still a negotiation.

How do you handle this?
What has actually worked for you when trying to get approval for technical cleanup or refactoring? Any frameworks, arguments, metrics, or stories that helped you convince non-technical decision-makers?

For me, showing smaller wins first, talking in terms of ROI instead of "clean code", and treating this like a sales process (because it is) made the biggest difference. But I'm curious how others handle the same battle.

If you want more of my thoughts on the topic, last edition of PHP at Scale is here:
https://phpatscale.substack.com/p/php-at-scale-14

https://redd.it/1ojw1w1
@r_php
How I can define my one naming convention upon foreighn key constraints and unique keys?

On Symfony I setup my db changes as:

php bin/console doctrine:schema:update


And I want to introduce migrations but because the introduction is a laborious task and it is getting iterrupted I though as a preparatory step to be an application of a common naming convention for unique constraints,indexes and foreighn keu definitions.

The goal it to annotate the foreihn key name definition upon ORM if nessesary but if not defined to use this naming convention:

fk_^base_table^_^referenced_table^


And its respective index as:

idx_^foreighn_key^


Is there a way to do this whithout need to annotate any Entity but only in particular cases?

https://redd.it/1ojx3l2
@r_php
Best practices for local development using Bref

I have recently started using Bref and loving it. I’m building a few small sites running on Lambda and it’s saving me quite a bit of money on hosting fees.

Also moved some existing sites to Bref and have been able to shut down servers.

The deploy command is very powerful and will setup all my SNS / SQS etc on AWS.

I hate the idea of having to have completely different logic for development than production. For example I run Bref in docker which also handles my assets, whilst in production they are uploaded to S3.

Anyone using Bref, how do you best bridge the gap between development / local and production? Localstack seems a good solution but is limited as well.

https://redd.it/1ok9nhm
@r_php
Best PHP and computer science courses for professional development in 2026?

Hey everyone,

I’m a full-stack web developer looking to level up my PHP skills in 2026. I’m mostly self-taught, so I want to rebuild my fundamentals from the ground up, not just in PHP but in computer science in general. I also want to dig into more advanced topics like modern architecture, design patterns, performance, and testing.

I’m open to online or in-person courses, certifications, or developer conferences that can help me become a stronger and more well-rounded developer.

If you’ve taken any courses or attended any events that really helped you grow, I’d love to hear your recommendations.

Thanks in advance!

https://redd.it/1okv8ot
@r_php
Is there a tool that is able to convert a dump into Symfony Migration?

I am in search for a tool that allows me to convert an SQL dump into a Symfony migration, the reason why is because I am reintroducing migrations into my system and I my coleagues to just run:

  
php bin/console doctrine:migrations:migrate


In order to setup a new Db schema. Is there a way to do this, does worth the effort and time?

https://redd.it/1okvedt
@r_php
Trying to make my own login logic but Fortifys routes are blocking my routes.

Yeah I’m just fiddling so no need to bark at me for changing the login logic.

But where are the fortify /login /register routes or can I ”publish” the stubs? Currently npm run dev gives errors about duplicate routes when I add /login /register to web.php

I’m using Laravel 12.32 something with inertia vue.

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