PHP Reddit – Telegram
PHP Reddit
34 subscribers
289 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
Websockets in php

So i have been looking into rachetPHP for websockets and I just cant seem to get it working, as I am able to connect but then messages are not sent to the server as I am not seeing them in the browser nor in the command line from which i have initiated the server. If you have more experience with this please shine some light on me as I am clueless on setting up and managing web sockets in php.

https://redd.it/1m5ov9a
@r_php
Dockerized PHP environments – images for CLI, FPM, and full LEMP/LAMP stacks

Hey folks,

I wanted to share a personal project I’ve been maintaining:
👉 https://github.com/fbraz3/php-system-docs

It’s a collection of Docker images for PHP that I’ve built and refined over time. The goal was to have clean, flexible images for everything from basic CLI tasks to full LEMP/LAMP stacks—ideal for dev environments, CI/CD, or even small-scale production workloads.

Some highlights:

Weekly automated builds
Multi-version support
Lightweight and optimized images
Includes tools like WP-CLI, Composer, Symfony CLI, phpMyAdmin, etc.

Even though I’m not working with PHP on a daily basis anymore, the language played a huge role in my journey as a developer, and I wanted to give something back to the community that helped me grow.

Any feedback or suggestions are welcome—and feel free to open issues, contribute, or just give it a star if you find it useful!

Cheers 🍻

https://redd.it/1m5uih9
@r_php
Tell me about your code quality controls

What have you found to be effective in your ci/cd for code quality?

I want to maximize automated quality enforcement without annoying the Devs. I've already got Pint / phpcsfixer commiting fixes to PRs, via GitHub actions.

My last job was legacy spaghetti hell.

Now I'm tech lead at a scale up with a 1 year old modern code base (TALL11/ php83).
We're taking over as an internal team from an agency.

They've done a good job but the code has been written quite free and breezy, with speed over quality as you'd expect from an MVP product.


https://redd.it/1m5va55
@r_php
Entreprise grade reporting engine

We're in the process of rewriting our desktop app to a web app. Our backend is in PHP (Laravel) and we're evaluating what reporting egines are available to us.

Our app has more than 50 reports, some are quite complex and have very precise layouts.

Dompdf or PhpSpreadsheet would not be enough in our case (we need a real report designer, page header/footer, multiple levels of groups with header/footer...) hence why I'm saying "Entreprise grade"

I'm looking for ideas and feedback (good or bad) about reporting engines.

Right now at the top of my list is Stimulsoft's "Report.php" which ticks all our boxes, we're starting a POC in a few weeks.

We also like Jasper reports, even if the report serrver needs Java.

Do you have on-field experience about those two, or did you go with something else, and why ?

https://redd.it/1m5wlry
@r_php
composer.json - should use jsonc format

composer.json - should support jsonc format.

I would kill for the ability to add comments to composer.json.

I got bunch of noscripts defined in a noscripts section and it's so frustrating looking at composer.json and not being able to remember what those were for.

Or even all the configs defined - I would love to be able to add comments. Like - to indicate what certain library is used for or what certain config option is for.

https://redd.it/1m6c3cb
@r_php
What are your top myths about PHP?

Hey folks!

I’m working on a series of articles about the most common myths surrounding different programming languages.

Would love to hear your favorite myths or misconceptions — drop them below

https://redd.it/1m6c6s7
@r_php
Why don't we break switch cases by default?

Before anything else: This isn't me calling for a revolt, a change, or this being considered a bug or flaw. Neither am I trying to make a case (ha!). I have no issue with how it is, I'm asking out of curiosity. Nothing more :)

I wrote a switch block today. You know, ... switch, case, the action you want to perform, break, ... hm... "break"…? I mean, I know, otherwise it would continue to the next step. I don't think I ever wrote a switch block with breaks exclusively. Not sure if I've ever seen code that was different, though that might just be me not having paid attention or the kind of code I usually deal with. Am I an outlier here, is my perception warped? Why is it this way around, having to explicitly break instead of that being the default?

I may overlook something obvious, something hidden, something historic, ... I can speculate as much as I want, but if somebody actually knows, I'd be interested.

https://redd.it/1m6fnc9
@r_php
PHP the right way, but for testing ?

Hey everyone!
I recently changed companies, and for the first time in my life, I’m seeing what proper, professional use of tests looks like. I’m realizing every day just how weak my understanding of testing has been all along…

I really need to rebuild (or maybe build from scratch) my foundation and then work on advancing my knowledge from there.

Do you know of any great resources that cover the fundamentals of testing, especially in the context of PHP?

P.s. everything

https://redd.it/1m6hhy2
@r_php
Whats the best place to host a simple PHP website?

New to PHP and coming from Ruby on Rails, Python, and Next.js. I've used Vercel before, I've heard of Hertzner, but I'm looking for a free way to deploy a very simple, almost static PHP website and wondering what people use.

https://redd.it/1m6rrlc
@r_php
What are some unusual coding style preferences you have?

For me, it's the ternary operators order.

Most resources online write it like this...

$test > 0 ?
'foo' :
'bar';

...but it always confuses me and I always write it like this:

$test > 0
? 'foo'
: 'bar';

I feel like it is easier to see right away what the possible result is, and it always takes me a bit more time if it is done the way I described it in the first example.

https://redd.it/1m73bzn
@r_php
Built a PHP framework that plays nice with legacy code - hope someone finds it useful

I've been working on a PHP framework called Canvas that I think solves a real problem many of us face: how do you modernize old PHP applications without breaking everything?

The core idea: Instead of forcing you to rewrite your entire codebase, Canvas uses a "fallthrough" system. It tries to match Canvas routes first, and if nothing matches, it automatically finds your existing PHP files, wraps them in proper HTTP responses, and handles legacy patterns like exit() and die() calls gracefully.

## How it works

You create a new bootstrap file (like public/index.php) while keeping your existing structure:

<?php
use Quellabs\Canvas\Kernel;
use Symfony\Component\HttpFoundation\Request;

require_once __DIR__ . '/../vendor/autoload.php';

$kernel = new Kernel([
'legacy_enabled' => true,
'legacy_path' => __DIR__ . '/../'
]);

$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();


Now your existing URLs like /users.php or /admin/dashboard.php continue working exactly as before, but you can start writing new features using modern patterns:

class UserController extends BaseController {
/**
* @Route("/api/users/{id:int}")
*/
public function getUser(int $id) {
return $this->json($this->em->find(User::class, $id));
}
}


## What you get immediately

- ObjectQuel ORM - A readable query syntax inspired by QUEL
- Annotation-based routing
- Dependency injection
- Built-in validation and sanitization
- Visual debug bar with query analysis
- Task scheduling

But here's the key part: you can start using Canvas services in your existing legacy files right away:

// In your existing users.php file
$em = canvas('EntityManager');
$users = $em->executeQuery("
range of u is App\\Entity\\User
retrieve (u) where u.active = true
sort by u.createdAt desc
");


## Why I built this

This framework grew out of real pain points I've experienced over 20+ years. I've been running my own business since the early 2000s, and more recently had an e-commerce job where I was tasked with modernizing a massive legacy spaghetti codebase.

I got tired of seeing "modernization" projects that meant rewriting everything from scratch and inevitably getting abandoned halfway through. The business reality is that most of us are maintaining applications that work and generate revenue - they just need gradual improvement, not a risky complete overhaul that could break everything.

The framework is MIT licensed and available on GitHub: https://github.com/quellabs/canvas. I hope someone else finds this approach useful for their own legacy PHP applications.

https://redd.it/1m75j9a
@r_php
PHP learning material for beginners

Hello, guys, I want to start learning php to be able to build relatively simple web sites with databases, user authentication, cookies etc. I don't strive for becoming php guru, I just want to understand backend basics and server-side processes.

Are there any good beginner-friendly, up-to-date learning material like books or websites with tutorials that cover php, database handling, authentication and other relevant stuff?

I found out about the book "PHP and MySQL web development" by Luke Welling, but the last edition was released in 2016-2017 and I don't know whether it's outdated or not.

Thanks in advance


https://redd.it/1m7czpa
@r_php
Finding Fullstack wannabe community

Now im in the 2nd year of college, lately im on my self-portfolio project. So i wonder if i can find some friends from community where we can share, help, or team up with whom has the same interest to be fullstack dev in future.

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