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
Symfony just introduced AI Components - thoughts on this for Laravel?

Symfony just dropped new AI Components that make it easy to integrate AI providers (OpenAI, Claude, etc.) and build agents, assistants, and more directly in your app.

Honestly, this feels like a big step forward for PHP – finally a proper abstraction for working with AI without having to glue APIs manually. (Prism does not really cover agents, and Neuron AI feels… uninspired.)

I really need this for Laravel.

Taylor, please make it happen

https://redd.it/1mh9203
@r_php
Deployment Suggestions for Dockerized Laravel Enterprise App (Azure vs AWS)

Hi everyone,

I’m developing software for a small company that handles about 800 customers per year. They’ve asked me to replace a legacy application stack that currently runs entirely on a single AWS EC2 instance. The backend processes government data with \~1.5 million records added annually.

I’ve rebuilt the system as a Dockerized Laravel app with PostgreSQL, using Docker Compose for local development.

My client is open to either AWS or Azure. I'm aiming for a **transparent, modern deployment process**—ideally using GitHub Actions for CI/CD. I'm currently debating between:

* **Recreating their setup** using an EC2 instance (perhaps with Docker)
* **Modernizing** with something like **Azure Container Apps**, **AWS App Runner**, or similar

What’s the best path forward for this kind of app? I’m particularly interested in:

* CI/CD workflows you’ve used for Laravel in production
* Experiences with Azure Container Apps vs AWS Fargate/App Runner
* Trade-offs of managing containers directly vs using PaaS-style services

Thanks in advance!

https://redd.it/1mh9j63
@r_php
Laravel Analytics beyond visits - SimpleStats 5.0

Hi folks,

while everyone was enjoying Laracon US, we've worked hard to finally release SimpleStats 5.0 with a bunch of new features and improvements!

SimpleStats is a server-side, GDPR compliant and 100% accurate analytics tool for Laravel applications, that goes beyond simple counts of views and visits. It shows you in-depth metrics like Registrations, Conversion Rate, Daily Active Users, campaign ROI, Average Revenue per User, Total Revenue and much more in just a few minutes!

Laravel Analytics Dashboard of SimpleStats

Here’s what’s new:

Improved performance and scalability \- especially noticeable when exploring large time ranges
Event-based pricing (no more total limit blocks for visitors, registrations, etc.)
Email reports for projects (daily/weekly/monthly reports of your project KPIs)
Instant project alerts on new user or payment (disabled by default - ideal for early-stage or smaller teams)
Dark mode improvements and manual toggle in user profile
Redesigned onboarding and registration flow
Dashboard remembers your last selected filters instead of always resetting to “last 7 days”
Fixed edge cases in DAU/WAU/MAU calculation
UI/UX improvements throughout the app
Mobile & responsive improvements for better navigation on all devices
Improved ingestion performance on API stats endpoints
Clickable charts for detail view feature now also supported for week range types
Many small bug fixes and visual refinements
Improved documentation

Feel free to step by and check out SimpleStats at: https://simplestats.io

Thanks for reading,
Zacharias

PS: Your feedback is highly appreciated!

https://redd.it/1mha25s
@r_php
Is thos preferred or not?
https://redd.it/1mhf61o
@r_php
This media is not supported in your browser
VIEW IN TELEGRAM
What is the latest app you built for just yourself? I love janky one day builds like this.

https://redd.it/1mhg3t8
@r_php
Laravel Analytics Beyond Pageviews - SimpleStats 5.0

Hi folks,

while everyone was enjoying Laracon US, we've worked hard to finally release SimpleStats 5.0 with a bunch of new features and improvements!

SimpleStats is a server-side, GDPR compliant and 100% accurate analytics tool for Laravel applications, that goes beyond simple counts of views and visits. It shows you in-depth metrics like Registrations, Conversion Rate, Daily Active Users, campaign ROI, Average Revenue per User, Total Revenue and much more in just a few minutes!

Laravel Analytics Dashboard of SimpleStats

Here's what's new:

Improved performance and scalability - especially noticeable when exploring large time ranges
Event-based pricing (no more total limit blocks for visitors, registrations, etc.)
Email reports for projects (daily/weekly/monthly reports of your project KPIs)
Instant project alerts on new user or payment (disabled by default - ideal for early-stage or smaller teams)
Dark mode improvements and manual toggle in user profile
Redesigned onboarding and registration flow
Dashboard remembers your last selected filters instead of always resetting to "last 7 days"
Fixed edge cases in DAU/WAU/MAU calculation
UI/UX improvements throughout the app
Mobile & responsive improvements for better navigation on all devices
Improved ingestion performance on API stats endpoints
Clickable charts for detail view feature now also supported for week range types
Many small bug fixes and visual refinements
Improved documentation

Feel free to step by and check out SimpleStats at: https://simplestats.io

Thanks for reading,
Zacharias

PS: Your feedback is highly appreciated!

https://redd.it/1mhd868
@r_php
Using query builder with manually written SQL

While it is tempting to ditch ORMs and query builders to write all SQL manually, writing 20 slightly different queries for `Repository::getStuffAndMoreStuffByThisAndThat()` methods quickly becomes tedious.

If only it would be possible to start with a manually written base query and then modify it using builder methods... Well, it is actually possible, at least when dealing with Postgres, using [pg\_wrapper](https://github.com/sad-spirit/pg-wrapper) / [pg\_builder](https://github.com/sad-spirit/pg-builder) / [pg\_gateway](https://github.com/sad-spirit/pg-gateway) packages.

A quick overview of these:

**pg\_wrapper** is an object-oriented wrapper for native pgsql extension and converter of complex types between Postgres and PHP (dates and times, intervals, ranges, arrays, composite types, you name it). It transparently converts query result fields to proper PHP types.

**pg\_builder** is a query builder for Postgres that contains a reimplementation of the part of Postgres own SQL parser dealing with DML (it can parse `SELECT` and other preparable statements but cannot parse e.g. `CREATE TABLE`). The query being built is represented as an Abstract Syntax Tree of Node objects. This tree can be freely modified, new parts for it can be provided either as Nodes or as strings.

**pg\_gateway** is a Table Data Gateway implementation depending on the above two.

* It reads tables' metadata to transparently convert query parameters as well.
* The same metadata is used by helpers to build common `WHERE` conditions, column lists and the like.
* Queries built by gateways' `select()` methods behave like database views: they can be added to other queries via joins, CTEs, `exists()` clauses.
* As we are using pg\_builder under the hood, query parts can be given as strings and query AST can be modified in any way when needed.

I already [wrote about these a couple years ago](https://www.reddit.com/r/PHP/comments/16lyknf/pggateway_mix_and_match_manually_written_sql_with/), there were a lot of changes since then

* I ate my own dog food by using pg\_gateway in a few projects, this led to major API overhaul and quality-of-life changes.
* The packages were upgraded for PHP 8.2+ (yes, PHP 8.4+ versions are planned, but not quite now).
* Last but not least, the docs were redone with tutorials / howtos added. [The soft deletes howto](https://pg-gateway.readthedocs.io/en/latest/howto-gateways.html) in particular shows starting with SQL strings and using builder after that. [The DTO howto](https://pg-gateway.readthedocs.io/en/latest/howto-mapping.html) shows using mappers to convert query results to DTOs

Hope for feedback, especially for the docs.

https://redd.it/1mhmom9
@r_php
PHP Security Poster (2009)
https://redd.it/1mi4xzt
@r_php
Code Quality

Hi guys, I hope you are all doing good.

How do you guys ensure code quality on your PHP application?
I am currently leading(a one man team🤣) the backend team for a small startup using PHP and Laravel on the backend.
Currently, we write integration test(with Pest), use PHPstan for static analysis(level 9), Laravel Pint for code style fixing.

I have recently been wondering how else to ensure code quality on the backend.
How else do you guys enforce / ensure code quality on your applications?
Are there specific configurations you use alongside these tools, or are there even some other tools you use that isn't here?
Thanks in advance, guys.

https://redd.it/1mi53j1
@r_php
Do you update flex recipes when upgrading Symfony version?

I just updated my app from Symfony 7.2 to 7.3. When using the `composer recipes:update` command, i get a big list of recipes to update. However, the process is annoying as i have to do it one by one with a commit after each. How important is this step and how do you do it?

https://redd.it/1mia8eh
@r_php
Excessive micro-optimization did you know?

Some built-in functions have compiler optimized versions that avoid a lot of the internal overhead of the PHP engine. By importing them in source files (e.g., use function array_map) or by prefixing them with the global namespace separator, for example \is_string($foo):

<?php

namespace SomeNamespace;

$now1 = microtime(true);
for ($i = 0; $i < 1000000; $i++) {
$result1 = strrev("Hello, World!");
}
$elapsed1 = microtime(true) - $now1;
echo "Without import: " . round($elapsed1, 6) . " seconds\n";

$now2 = microtime(true);
for ($i = 0; $i < 1000000; $i++) {
$result2 = \strrev("Hello, World!");
}
$elapsed2 = microtime(true) - $now2;
echo "With import: " . round($elapsed2, 6) . " seconds\n";

For this tight loop, it results in an 86.2% performance increase. This was tested with OPcache enabled. You will se smaller performance gains with it disabled.

Will this affect real world applications? Most likely not by much.

https://redd.it/1milupj
@r_php
AI & Programming

PHPStorm, my preferred IDE uses AI to predict what I’m writing. It works quite well but it does have me questioning the future of my job security and hobby.

While currently AI produces often buggy and difficult to maintain spaghetti, how much longer until this is no longer the reality?

Is there anything I should be doing to prepare for this?

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