PHP Reddit – Telegram
PHP Reddit
34 subscribers
292 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
Hey Laravel devs — how do you handle client requests for Elementor-style page builders in a custom CMS?

I intend to build a CMS in Laravel with custom SCSS/CSS. Many of the pages have **unique layouts** and **specific styles** per page, so implementing a generic drag-and-drop page builder like Elementor or Divi just doesn't make sense to me — it would be technically messy, overly complex, and go against the custom design system.

However, I still get client requests or suggestions for “page builder”-like functionality where they can drag and arrange sections, control layout, or build entire pages themselves.

Have you faced this dilemma? How did you handle it?

* Did you build a custom section/block-based system?
* Use any packages (like Filament, Nova, Livewire, etc.)?
* Or did you just draw a hard line and explain why it’s not feasible?

Looking for insights or real-world solutions from folks who’ve built structured CMS platforms with Laravel. Appreciate any thoughts or war stories!

https://redd.it/1k7lqy5
@r_php
Looking for PHP 8 equivalent of xref-lint

Can anyone recommend a linter for php 8 that works locally from the Linux command line? I'd come to depend on xref-lint for its features beyond "php -l", but it doesn't work on php 8. Thanks.

https://redd.it/1k7ogxl
@r_php
Me and PHP in a first love affair

I have always studied economic utopias, I have always imagined what it would be like to live in economies that solved the basic problems of human beings. I served as a volunteer in several areas, I learned a lot in each one and continue to learn, I studied philosophy, psychoanalysis, art, insect life... I came to a conclusion. The only way to accomplish something that benefits and builds a sustainable, self-sufficient and livable reality, within an inefficient and corrupt system like ours, would be volunteering. People who do what they do without looking at who they are without expecting anything in return other than the result of their actions and believe me, these people exist and there are many of them. On my Instagram Moveant.Brasil I found many people like this. And then, I encountered a problem... managing these volunteers efficiently and why not take advantage of and experience an economy based on time and not capital, without combating or excluding capitalism, just living parallel to it. But how to do this? I'm terrible at programming! I have difficulty learning, but… But we are in 2025 and as vintage as it is, I built a first prototype using AI, PHP and Hostinger…. And of course, it wasn't even close to what I imagined, but the logistics are beautiful and it moves me how it's possible to do things with so little, and damn, if I continue like this, I'm sure we'll build something incredible.

https://redd.it/1k80yy2
@r_php
Next Steps in Tech: How Can I Break Into a $100K+ Career?

I have college degrees and about 1.5 years of experience working with CakePHP. Lately, I’ve been feeling like I’m not making the progress I want by sticking solely with this path. I’m ready to explore something new — ideally aiming for a salary around $100K per year. I’m open (and committed) to unlearning old habits and learning new skills if needed.

Given that I’m based in Canada, what career paths or technologies would you recommend I explore?

https://redd.it/1k852dg
@r_php
should i learn php or javanoscript after learning html and css?

I think I only have around 6 months left to learn web development before our Capstone 1 project. I used to study coding on and off, but I only reached the basics of JavaScript. I eventually lost motivation and stopped learning, so I forgot everything and had to start from scratch. Should I study PHP right after HTML and CSS so I can get an idea of backend development and build a functional system? I'm also thinking about hosting when the time comes for our capstone — it might be expensive if we use a backend language that isn’t well-supported. I also noticed that the roadmaps involving JavaScript and React would take much longer to learn, and they don't focus much on the backend. Maybe you have some suggestions. Thank you in advance.

https://redd.it/1k88o0k
@r_php
Sylius framework for non e-commerce projects - bad idea?

Currently I'm trying to decide which frameworks to choose for my freelance projects. I need an e-commerce one and a regular one for just simple appointment system type of pages. For an e-commerce I will try the Sylius framework, it looks pretty decent and fulfils all my needs.

Now for the regular pages - I can't decide between OctoberCMS and a few others, but I wonder why not use the same one - Sylius. Just without all the e-commerce features it has to offer.

Has anyone tried it? I wonder if it makes sense and if there is any drawbacks if I decide to use it this way. From the first look it's pretty neat with all the user management features, nice looking admin panel, API etc. Also I love Symfony. It looks like a pretty decent framework to work on even when I don't need to build an e-commerce.

Of course I would need to disable all the e-commerce packages, so my question is - can I do it cleanly? Does it perform well?

https://redd.it/1k8dp90
@r_php
Finally Dockerized my Laravel based application with a minimal setup.

Hello All,

Quite often while sharing my githu repo for the Laravel based application I have been working on, I got asked if I could provide Dockerfile for the application.

So, by following tutorials and other resources online I have made Dockerfile and docker-compose.yml file so that it can easily be run inside docker.

I tried to follow official Docker page for Laravel setup, but the Dockerfile and docker-compose.yml files were too complicated. I just wanted a minimal setup, so that anyone with Docker could install the app easily and get a feel of it.

https://github.com/oitcode/samarium

It is a minimal setup with Apache server and MySql database. Docker installation instructions are in the README of github repo. Would appreciate if anyone looked into it and provided feedbacks.

I am planning to improve the docker setup, but for now, relieved that a minimal setup is working. There was many good things to learn while containerizing/dockerizing the app. That itself was a good experience. Hoping to improve further on this in future.

Thanks all.

https://redd.it/1k8eszh
@r_php
My new installable PHP Sandbox

Hello,

I have created a PHP Sandbox with NativePHP that I would like to share with everyone. It uses Electron to wrap the whole app and make it executable from your OS.

It is called PHP Dune, and it is available as Open Source in GitHub, or you can download the package for Windows, Mac and Linux.

This is the website: https://phpdune.salmonjump.com/
And this is the link to the repo: https://github.com/pabloFdz/PHPDune

I hope you find it useful!

https://redd.it/1k8gvha
@r_php
Questioning about PasswordStrength Constraint

I would like to use the Constraint PasswordStrength to validate that the user passwords are strong enough. Ideally I would like to not create my custom PasswordStrengthValidator, but I also would like to return custom messages to help user to create a correct password if their are not strong enough (e.g tell them that the password needs uppercase, lowercase, special chars, and a given length).

But regarding the PasswordStrengthValidator I can't really understand what are the rules behind each levels


Here is the method that validate the strength in symfony/validator

    public static function estimateStrength(#\SensitiveParameter string $password): int
    {
        if (!$length = \strlen($password)) {
            return PasswordStrength::STRENGTHVERYWEAK;
        }
        $password = countchars($password, 1);
        $chars = \count($password);

        $control = $digit = $upper = $lower = $symbol = $other = 0;
        foreach ($password as $chr => $count) {
            match (true) {
                $chr < 32 || 127 === $chr => $control = 33,
                48 <= $chr && $chr <= 57 => $digit = 10,
                65 <= $chr && $chr <= 90 => $upper = 26,
                97 <= $chr && $chr <= 122 => $lower = 26,
                128 <= $chr => $other = 128,
                default => $symbol = 33,
            };
        }

        $pool = $lower + $upper + $digit + $symbol + $control + $other;
        $entropy = $chars * log($pool, 2) + ($length - $chars) * log($chars, 2);

        return match (true) {
            $entropy >= 120 => PasswordStrength::STRENGTH
VERYSTRONG,
            $entropy >= 100 => PasswordStrength::STRENGTH
STRONG,
            $entropy >= 80 => PasswordStrength::STRENGTHMEDIUM,
            $entropy >= 60 => PasswordStrength::STRENGTH
WEAK,
            default => PasswordStrength::STRENGTHVERYWEAK,
        };
    }
    public static function estimateStrength(#\SensitiveParameter string $password): int
    {
        if (!$length = \strlen($password)) {
            return PasswordStrength::STRENGTHVERYWEAK;
        }
        $password = countchars($password, 1);
        $chars = \count($password);


        $control = $digit = $upper = $lower = $symbol = $other = 0;
        foreach ($password as $chr => $count) {
            match (true) {
                $chr < 32 || 127 === $chr => $control = 33,
                48 <= $chr && $chr <= 57 => $digit = 10,
                65 <= $chr && $chr <= 90 => $upper = 26,
                97 <= $chr && $chr <= 122 => $lower = 26,
                128 <= $chr => $other = 128,
                default => $symbol = 33,
            };
        }


        $pool = $lower + $upper + $digit + $symbol + $control + $other;
        $entropy = $chars * log($pool, 2) + ($length - $chars) * log($chars, 2);


        return match (true) {
            $entropy >= 120 => PasswordStrength::STRENGTH
VERYSTRONG,
            $entropy >= 100 => PasswordStrength::STRENGTH
STRONG,
            $entropy >= 80 => PasswordStrength::STRENGTHMEDIUM,
            $entropy >= 60 => PasswordStrength::STRENGTH
WEAK,
            default => PasswordStrength::STRENGTHVERYWEAK,
        };
    }



So imagining I would like to use PasswordStrength Constraint with STRENGTH_MEDIUM what should be the prerequisite of a correct password ?

https://redd.it/1k8mzcf
@r_php
Requesting feedback on my SQL querybuilder

Throughout the years, i've developed a framework i use for personal (sometimes professional) projects. It suits most of my needs for a back-end/microservice framework, but i've grown particulairly fond of my querybuilder/ORM.

Here is the public repo: https://github.com/Sentience-Framework/sentience-v2/

For a quick look at some examples: https://github.com/Sentience-Framework/sentience-v2/blob/main/src/controllers/ExampleController.php

Database documentation: https://github.com/Sentience-Framework/sentience-v2/blob/main/documentation/documents/database.md


The feedback i'm mostly interested in, is which features you'd like to see added to the querybuilder. Security / performance / coding principle conceirns are always welcome ofcourse :)

https://redd.it/1k8ojj0
@r_php
CORS issue on PHP backend hosted on Hostinger (some APIs work in browser, some don't

Hey everyone,
I'm facing a strange CORS issue and need some help.

I have a PHP backend hosted on Hostinger.
When I test my APIs with Postman, everything works fine.
When I test from my frontend (browser), some APIs work — but some others give CORS errors on windows but all work when use Linux

After some research, I realized Postman doesn't care about CORS, but browsers do.

https://redd.it/1k8oai4
@r_php
Weekly /r/Laravel Help Thread

Ask your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips:

What steps have you taken so far?
What have you tried from the documentation?
Did you provide any error messages you are getting?
Are you able to provide instructions to replicate the issue?
Did you provide a code example?
Please don't post a screenshot of your code. Use the code block in the Reddit text editor and ensure it's formatted correctly.

For more immediate support, you can ask in the official Laravel Discord.

Thanks and welcome to the r/Laravel community!

https://redd.it/1k98qs4
@r_php
Would you prefer namespace-level privacy?

In some programming languages like Java you get more flexibility in your levels of privacy e.g.- a “protected” method can be accessed by any class in the same “package” (in PHP we use the term “namespace” instead of package but it’s the same idea).

Also a whole class itself in Java can be declared protected or private and this will affect its visibility in useful, subtle ways.

In PHP it’s possible to use attributes combined with static analysis to simulate this but it’s not as desirable as having the features built into the language.
I’m a real stickler for the defensive style of programming so that only certain classes can see/access other classes. Also, it’s good for DDD when one class can see the internal properties of another class in the same namespace (e.g.- for persistence or presentation) without needing lots of “getter” methods.

I’m interested in hearing the thoughts of the wider PHP community on this.

https://redd.it/1k9ccu0
@r_php
Question about TwigMarkup Extra bundle and league/commonmark

I am trying to put together a document from markup using the TwigExtra Markdown package with league/commonmark for the trasnpiler. I have several tables that need to be implemented from the markdown, and I need to tell commonmark to use the TableExtension. However, I cannot find a suitable piece of documentation to even start trying to figure out how to configure this. Anybody have any solutions? Thank you.

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