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
Monitor Slow Queries using Laravel Build in Features

Did you know that you can monitor slow queries without using any packages or tools?

//AppServiceProvider

public function boot(): void
{
$maxTimeLimit = 500;
// in milliseconds


if (!$this->app->isProduction()) {
DB::
listen
(static function (QueryExecuted $event) use ($maxTimeLimit): void {
if ($event->time > $maxTimeLimit) {
throw new QueryException(
$event->connectionName,
$event->sql,
$event->bindings,
new Exception(message: "Individual database query exceeded {$maxTimeLimit}ms.")
);
}
});
}
}

With this method, you don’t need to look away. An exception is thrown every time a request exceeds the threshold. You can make it to log queries instead of throwing an exception which is useful in production.

public function boot(): void
{
$maxTimeLimit = 500;
// in milliseconds


if ($this->app->isProduction()) {
DB::
listen
(static function (QueryExecuted $event) use ($maxTimeLimit): void {
if ($event->time > $maxTimeLimit) {
Log::warning(
'Query exceeded time limit',

'sql' => $event->sql,
'bindings' => $event->bindings,
'time' => $event->time,
'connection' => $event->connectionName,

);
}
});
}
}

https://redd.it/1k6tewm
@r_php
Show & Tell Relaticle - An Open Source Laravel-based CRM I've Been Building (+ Questions About Plugin Licensing)

# Hey r/laravel!

I've been working on Relaticle, an open-source CRM built entirely with Laravel 12 and Filament 3. After months of development, I'm excited to share it with the community that has taught me so much over the years.

# What is Relaticle?

Relaticle is a comprehensive CRM platform focusing on simplicity and customization. Built for teams managing client relationships, sales pipelines, and collaboration workflows, it includes:

People/company management with custom fields
Kanban-style sales pipeline for opportunities
Task management with assignments and due dates
Team workspace organization

# Technical Stack

Laravel 12
PHP 8.3 (with strict typing throughout)
Filament 3 for the admin panel and UI components
Livewire 3 for reactivity
Alpine.js for frontend interactions
PostgreSQL (though configurable)
Comprehensive test suite with Pest
Architecture that enforces single responsibility, readonly classes, and clear abstractions

I've focused heavily on developer experience, with comprehensive documentation, thorough type hints, and consistent patterns.

# The Custom Fields Challenge

Here's where I'd love the community's input. The core of Relaticle's flexibility comes from a Custom Fields package I developed. It's robust enough to be used independently, allowing any model to have completely customizable fields and sections (similar to how Notion allows custom properties).

Initially, I planned to sell this package separately (it's listed in composer.json as a premium component from a private Composer repository). However, I'm questioning this approach since:

1. It feels against the spirit of open source to have a core functionality behind a paywall
2. Yet it represents hundreds of hours of development and testing

My question: What do you think is the right approach here? Some options I'm considering:

Open source it entirely
Dual license (OSS for Relaticle, commercial license for standalone use)
Keep it as a premium component with a free tier
Provide it fully free but offer paid support/implementation

# Why I Built This

I was dissatisfied with existing CRMs - either too complex, too expensive, or not customizable enough. Laravel and Filament make it possible to build something that's both powerful and elegant.

The repo is available at https://github.com/Relaticle/relaticle . I'd love your thoughts on the approach, code quality, and especially the Custom Fields licensing question.

Thanks for being such a supportive community!

https://redd.it/1k6x0t2
@r_php
Why is latestOfMany() orders of magnitude slower than using a manual subquery?

For context, a hasOne(ModelName::class)->latestOfMany() relationship creates a complex aggregate WHERE EXISTS() subquery with another nested (grouped) subquery, and in some cases it can be extremely slow, even if you've added every conceivable index to the table.

In some cases it performs a full table scan (millions of rows) even though the "outer/parent" query is constrained to only a few rows.

With this manual "hack", calling count() on this relationship went from 10 seconds to 7 milliseconds

return $this->hasOne(ModelName::class)->where('id', function ($query) {
$query->selectRaw('MAX(sub.id)')
->from('tablename AS sub')
->whereColumn('sub.lead
id', 'tablename.leadid');
});

Which is nice I guess, but it annoys me that I don't understand why. Can any of you explain it?


https://redd.it/1k6r70y
@r_php
Struggling to hire a Senior PHP Developer in the UK

Where is the best place to find (and hire) Senior PHP developer in the UK?

Could anyone please advise where you would look for such a job outside of LinkedIn?

We've used Dev specific recruiters but they're clearly not vetting their applicant and when we do post on LinkedIn we get mainly people from mainland Europe applying.

Any help would be appreciate. Thanks

Edit.
I will try come back to people individually but just to clarify. I’m not complaining, just looking for advice. I can’t post a job app on here as it’s against the rules however if anyone wants to ask for the spec, I’m more than happy to DM them a link if that’s acceptable?

https://redd.it/1k6uy6m
@r_php
How do I level up my game ?

I’ve been working as a PHP full-stack developer (CodeIgniter & Laravel) at a small organization for three months now, building and shipping new features on the company’s two websites. Every time I get a task, I lean on AI to scaffold the solution—but I never just copy-paste. I break down every line to make sure I actually understand it.

So far, zero complaints about my code and my PRs always get merged. I might take a little extra time, but I’ve never backed down from a challenge.

Here’s the kicker: I feel seriously underpaid—my salary isn’t even $100 per month. In an ideal world, I’d be earning around $3,500–$4,000 USD per year, but that’s not happening at my current gig.

I’m based in India, where PHP devs often get paid peanuts—and I’m not ready to ditch PHP just for a fatter paycheck.

I’m planning to move on and find a place that actually values my skills. Before I start applying, I need to upskill… but with so many options out there, I’m not sure where to focus.

Any advice on what I should learn next to level up my PHP game ? What is the demanding tech stack (PHP included) ?

https://redd.it/1k711uk
@r_php
Laravel Package

Hey devs 👋

After years of repeating the same Artisan commands, I finally got tired of the boilerplate and decided to build something that would actually speed things up.

So I just released a package called RapidsModels (or just rapids) – it’s designed to generate your models + migrations + seeders + factories + relationships in one single command:

php artisan rapids:model Product

It’s interactive (asks you for fields, types, relations, etc.), and it supports:

One-to-one, one-to-many, many-to-many relationships (with pivot model/migration)
Smart detection of existing models
Clean output that respects naming conventions
Seeders + factories out-of-the-box

🎯 Goal: Cut dev time and standardize model generation across projects.

🧪 It's still early-stage, but it's stable and I use it daily in my own Laravel projects.
📦 GitHub: https://github.com/Tresor-Kasenda/rapids
💬 I'd love feedback, ideas, feature requests, PRs, or bug reports!

Thanks for reading, and I hope it helps someone out there 😄

https://redd.it/1k6zupx
@r_php
What’s your go-to workflow when building a new web app from scratch?

There are so many ways to build apps these days — no-code, low-code, AI copilots, boilerplates, full custom builds. I'm curious: what’s your current process when starting a new web app?

Do you go straight into writing code? Use templates or starter kits? Lean on AI tools (in your IDE or browser)? Or do you start with a low/no-code tool to validate first?

Also curious how much you mix things up—like prototyping fast with no-code, then switching to a custom stack later.

What makes you feel the most productive right now?

Would love to hear how others are doing it in 2025.

https://redd.it/1k7f3hz
@r_php
Learning PHP the right way?

Hello there I hope you're doing fine, so when I started to learn PHP I started watching Gio Channel in YouTube and I stopped when he started explaining classes.

From then I jumped into learning laravel I didn't took any courses something I just like followed a refollowed and refollowed the documentation , I look up whatever I need to look up not that proficient in laravel as well I mean I'm okay I'm good I can do what I think but not in a proficient level but more like on a amateur level.

Find out I want to master the craft of software development I see myself more dependent on llms rather than actually learning and I feel that it starts to slip, the coding skills starts to sleep again and I want to do it right this time I know a little bit of JavaScript and PHP I'm familiar mostly with frontend frameworks like vue, solid I'm starting to learn svelte as well.

I wanna learn PHP the right way like the concepts of the programming languages+ the concepts of backend development stuff.



https://redd.it/1k7ltao
@r_php
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