PHP Reddit – Telegram
PHP Reddit
34 subscribers
291 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
Is it safe to use emulated prepared statements in Laravel?

Hi everyone,

I’m building a DBA assistant. One challenge we’ve encountered is prepared statements in MySQL and MariaDB. They don’t leave much for analysis after they’re executed. We've sent this problem to MariaDB core developers.

Since Laravel uses PDO with prepared statements by default, it makes profiling harder. But there’s an option to enable “emulated” prepared statements in PDO. When enabled, queries are sent as raw SQL, which is easier to log and analyze.

So I’m wondering:

Would it be safe to enable emulated prepared statements in Laravel - at least in dev or staging - to get better query insights?

Curious to hear your thoughts.

https://redd.it/1kr08bs
@r_php
Accessing $this when calling a static method on a instance

In PHP, you can call a static method of a class on an instance, as if it was non-static:

class Say
{
public static function hello()
{
return 'Hello';
}
}

echo Say::hello();
// Output: Hello

$say = new Say();
echo $say->hello();
// Output: Hello

If you try to access $this from the static method, you get the following error:

>Fatal error: Uncaught Error: Using $this when not in object context

I was thinking that using isset($this) I could detect if the call was made on an instance or statically, and have a distinct behavior.

class Say
{
public string $name;

public static function hello()
{
if (isset($this)) {
return 'Hello ' . $this->name;
}

return 'Hello';
}
}

echo Say::hello();
// Output: Hello

$say = new Say();
$say->name = 'Jérôme';
echo $say->hello();
// Output: Hello

This doesn't work!

The only way to have a method name with a distinct behavior for both static and instance call is to define the magic __call and __callStatic methods.

class Say
{
public string $name;

public function call(string $method, array $args)
{
if ($method === 'hello') {
return 'Hello ' . $this->name;
}

throw new \LogicException('Method does not exist');
}

public static function callStatic(string $method, array $args)
{
if ($method === 'hello') {
return 'Hello';
}

throw new \LogicException('Method does not exist');
}
}

echo Say::hello();
// Output: Hello

$say = new Say();
$say->name = 'Jérôme';
echo $say->hello();
// Output: Hello Jérôme

Now that you know that, I hope you will NOT use it.

https://redd.it/1kr9kh3
@r_php
Meract: A PHP MVC Framework with Built-in Frontend Integration (Morph) – Looking for Feedback

I’ve been working on Meract, an MVC framework for PHP that bridges backend and frontend seamlessly. It’s designed for developers who want an all-in-one solution with minimal setup. Here’s why it might interest you:

1. Morph: Integrated Frontend Framework
2. Laravel-like Syntax
1. Familiar routing, models, and migrations: Route::get('/post/{id}', [PostController::class, 'show']);  
3. CLI Powerhouse (mrst)
4. Auth & Storage Out of the Box
5. Why Another Framework?
1.    Unifies backend and frontend (Morph eliminates the JS build step for simple apps).
2.    Is lightweight but extensible (e.g., swap Storage drivers for Redis).
3.    Keeps PHP’s simplicity (no Webpack/config hell).
6. Is It Production-Ready?
1. Current state: Beta (The entire framework needs testing, and Morph, in particular, requires architectural improvements).
2. Github: https://github.com/meract/meract

https://redd.it/1krbhhh
@r_php
Introducing ConvergePHP (Beta)

After almost 5 months of development, my friends are going to announce the beta release of ConvergePHP, a clean, modern, and open-source framework built specifically for Laravel developers to build and manage documentation websites, with plans to support blogs in future releases

Key features available in this early release include:
- Laravel-first architecture.
- Helps build beautiful, structured documentation out of the box
- Seamless integration of Blade components within Markdown files.
- A fast, built-in search engine.
- Highly customizable themes enabling distinct presentation.
- and much more


Try it out here:
Website: https://convergephp.com
Source code: https://github.com/convergephp/converge

https://redd.it/1krddib
@r_php
How I can make doctrine:migrations:diff generate only sql files instead of migrations?

Usually `doctrine:migrations:diff` generate a migration noscript but instead of running them as is we only ghet the diff for the db and manually execute the queries one-by-one what I want is to modify this logic in order to generate sql files instwad of migrations noscript only for the `up` .

In other words I want to generate only raw sql for the diff instead of generating migration noscripts. How can do this?

https://redd.it/1kreyi5
@r_php
Senior Symfony Developer (15+ Years Exp) Seeking New Opportunities — Remote/Contract

Hi r/symfony! 👋

(Yes, I got help from an LLM to summarise my intention)

I’m Emre, a Senior Fullstack Developer with 15+ years of deep PHP/Symfony expertise, and I’m currently exploring new opportunities. If your team needs someone who can architect complex systems, lead projects, or modernize legacy codebases—let’s chat!

Why I love Symfony:

* Built scalable platforms like TRT News (42 multilingual subsites), Sylius-based e-commerce (Bilimkutusu.com), and academic journal systems (Dergipark).
* Contributed to Symfony’s ecosystem as an open-source maintainer and PHP community organizer (founder of AnkaraPHP).
* Ran workshops and conference talks on Symfony best practices (check my [YouTube](https://youtube.com/@delirehberi) for proof 😄).

What I’m looking for:

* Remote roles (open to contracts or full-time).
* Symfony-centric backend work, API development, or fullstack projects (React/Vue/Node.js).
* Teams passionate about clean code, DevOps (Docker, AWS/GCP), or innovative PHP tooling.

My GitHub/LinkedIn:

* [GitHub](https://github.com/delirehberi) (open-source contributions)
* [LinkedIn](https://linkedin.com/in/delirehberi)
* Resume: [emre.xyz/resume.pdf](https://emre.xyz/resume.pdf)

Bonus: I’m also a functional programming nerd (Haskell!), love mentoring junior devs, and have a knack for migrating legacy systems to modern Symfony setups.

If you’re hiring or know someone who is, feel free to DM or comment below. Happy to share war stories about debugging Symfony apps or discuss why Nix + Symfony is a match made in heaven! 🚀

Thanks for being an awesome community—keep making PHP beautiful!

P.S. Open to relocation (EU-friendly) or freelance projects. Let’s build something great! 💻

https://redd.it/1krwm10
@r_php
Post reactions management and storage

Hi everyone,

For a cms solution, how to manage reactions on a post ? (Like, dislike, love, etc) in a scalable way ? Since each reaction is at a least write query then an update to a counter etc.

What database ? Or queue system do i need to manage it effectively?

https://redd.it/1ks3lrj
@r_php
I made a ORM named LiliDb taking advantage of Php modern features

Hello everyone at Php community, this post is a self-promotion for something I had made because I didn't like another ORM for Php (Doesn't uses Php modern features) and it will be awesome if somebody gives a try and make a feedback 😄

https://github.com/sebastianguzmanmorla/LiliDb

https://packagist.org/packages/sebastianguzmanmorla/lili-db

https://redd.it/1ksi8hg
@r_php
RANT: Can't Really Understand The JS Fanatics

They say in JS you can do front-end, back-end as well as mobile apps if needed all in JS. Is it really?

For every single thing, you need to learn something from the ground up. React's architecture and coding style is completely different than how Express works. I know I am comparing apples to oranges by comparing front end to back end. But the architecture do change right, unlike what JS fanatics claim that you can do it all in JS. They change so much that they feel like these frameworks are completely a different language. Where is the same JS here except for basic statements?

If they can understand to do so many different frameworks within JS, they might as well learn a new language as everything changes completely within JS from framework to framework.

https://redd.it/1kskbzf
@r_php
Prevent "out of memory" when I want list of many files

I have many many files at one folder, around 500.000 files. I want to list them, but server has not many memory to list all of files. Is there a way to list all files step by step by paging?

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