Weekly help thread
Hey there!
This subreddit isn't meant for help threads, though there's one exception to the rule: in this thread you can ask anything you want PHP related, someone will probably be able to help you out!
https://redd.it/1jtedf1
@r_php
Hey there!
This subreddit isn't meant for help threads, though there's one exception to the rule: in this thread you can ask anything you want PHP related, someone will probably be able to help you out!
https://redd.it/1jtedf1
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
A new Symfony SEO Bundle that handles all aspect of SEO
https://packagist.org/packages/rami/seo-bundle
https://redd.it/1jtgdz9
@r_php
https://packagist.org/packages/rami/seo-bundle
https://redd.it/1jtgdz9
@r_php
packagist.org
rami/seo-bundle - Packagist
All in One Symfony Seo Bundle
[Tutorial] Build Full Stack Instagram Clone with Laravel
https://www.youtube.com/watch?v=VK-2j5CNsvM
https://redd.it/1jthrq2
@r_php
https://www.youtube.com/watch?v=VK-2j5CNsvM
https://redd.it/1jthrq2
@r_php
YouTube
Full Stack Instagram Clone with Laravel and MongoDB – Tutorial
Master MongoDB with Laravel by building an Instagram clone. Learn document-based schema design, authentication, social features, and performance optimization techniques. Perfect for Laravel developers ready to move beyond SQL databases and leverage MongoDB's…
A new SEO Bundle that handles all aspect of SEO
https://packagist.org/packages/rami/seo-bundle
https://redd.it/1jtgb3b
@r_php
https://packagist.org/packages/rami/seo-bundle
https://redd.it/1jtgb3b
@r_php
packagist.org
rami/seo-bundle - Packagist
All in One Symfony Seo Bundle
TimescaleDB to the Rescue - Speeding Up Statistics
https://sarvendev.com/posts/timescale-db-to-the-rescue/
https://redd.it/1jts956
@r_php
https://sarvendev.com/posts/timescale-db-to-the-rescue/
https://redd.it/1jts956
@r_php
Kamil Ruczyński
TimescaleDB to the Rescue - Speeding Up Statistics
Some time ago, I was working on improving the performance of slow statistics. The problem was that our database contained billions of rows, making data retrieval slow, even for the last seven days. From a product perspective, we needed to display data for…
How much Livewire is too much Livewire
Kind of a philosophical question here I guess. I am probably overthinking it.
Backstory: I am a well versed Laravel dev with experience since v4. I am not a strong front end guy, and over the years never really got on board with all the javanoscript stuff. I just haven't really loved it. I have been teaching myself Vue and using it with Inertia and I actually like it a lot, but find myself incredibly slow to develop with it. Obvious that will change over continued use and experimentation, but sometimes I want to "just ship."
So I started tinkering with Livewire finally, and I understand the mechanics of it. I am actually really enjoying the workflow a lot and how it gives me some of the reactivity I am looking for in a more backend focused way. But I am curious if there's any general thoughts about how much Livewire is too much Livewire, when it comes to components on a page.
For example: In my upper navigation bar I have mostly static boring links, but two dropdowns are dynamic based on the user and the project they are working on. As I develop this I have made each of those dropdowns their own components as they are unrelated. This feels right to me from a separation of concerns standpoint, but potentially cumbersome as each of these small components have their own lifecycle and class/view files in the project.
I kind of fear if I continue developing in this manner I'll end up with a page that has 10, or more, components depending on the purpose/action of the page. So my question to the community and particularly to those who use a lot of Livewire. Does this feel problematic as far as a performance standpoint? Should my navigation bar really just be a single component with a bunch of methods in the livewire class for the different unrelated functions? Or is 10 or so livewire components on a page completely reasonable?
https://redd.it/1jtvt32
@r_php
Kind of a philosophical question here I guess. I am probably overthinking it.
Backstory: I am a well versed Laravel dev with experience since v4. I am not a strong front end guy, and over the years never really got on board with all the javanoscript stuff. I just haven't really loved it. I have been teaching myself Vue and using it with Inertia and I actually like it a lot, but find myself incredibly slow to develop with it. Obvious that will change over continued use and experimentation, but sometimes I want to "just ship."
So I started tinkering with Livewire finally, and I understand the mechanics of it. I am actually really enjoying the workflow a lot and how it gives me some of the reactivity I am looking for in a more backend focused way. But I am curious if there's any general thoughts about how much Livewire is too much Livewire, when it comes to components on a page.
For example: In my upper navigation bar I have mostly static boring links, but two dropdowns are dynamic based on the user and the project they are working on. As I develop this I have made each of those dropdowns their own components as they are unrelated. This feels right to me from a separation of concerns standpoint, but potentially cumbersome as each of these small components have their own lifecycle and class/view files in the project.
I kind of fear if I continue developing in this manner I'll end up with a page that has 10, or more, components depending on the purpose/action of the page. So my question to the community and particularly to those who use a lot of Livewire. Does this feel problematic as far as a performance standpoint? Should my navigation bar really just be a single component with a bunch of methods in the livewire class for the different unrelated functions? Or is 10 or so livewire components on a page completely reasonable?
https://redd.it/1jtvt32
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
Breeze: React (JSX) + Inertia + Laravel + NO Tailwind
Hey r/PHP ! (New here).
Quick question: Does anyone have a link to a starter kit, boilerplate, or public repo for Laravel + Inertia + React (JSX/JS) that sets up auth scaffolding (like Breeze) but comes without Tailwind CSS?
I'm looking to use vanilla CSS / CSS Modules and want to avoid the tedious process of manually removing all the Tailwind
Any pointers to existing solutions or recomendations would be amazing!
Thanks you very much.
https://redd.it/1jtxinm
@r_php
Hey r/PHP ! (New here).
Quick question: Does anyone have a link to a starter kit, boilerplate, or public repo for Laravel + Inertia + React (JSX/JS) that sets up auth scaffolding (like Breeze) but comes without Tailwind CSS?
I'm looking to use vanilla CSS / CSS Modules and want to avoid the tedious process of manually removing all the Tailwind
className attributes from the default Breeze components and all the UI add-ons. Just need a clean starting point with the routes and the auth but with minimal code and preferably not styling at all.Any pointers to existing solutions or recomendations would be amazing!
Thanks you very much.
https://redd.it/1jtxinm
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
New in Laravel 12.7: `whereAttachedTo()` for BelongsToMany Relationships
https://nabilhassen.com/new-in-laravel-127-whereattachedto-for-belongstomany-relationships
https://redd.it/1ju8r16
@r_php
https://nabilhassen.com/new-in-laravel-127-whereattachedto-for-belongstomany-relationships
https://redd.it/1ju8r16
@r_php
Nabilhassen
New in Laravel 12.7: `whereAttachedTo()` for BelongsToMany Relationships
Laravel 12.7 adds whereAttachedTo() — a cleaner way to query BelongsToMany relationships using model instances or collections.
Should I Learn Node.js First and Then Move to PHP, or Study Both at the Same Time?
Should I learn Node.js first and then switch to PHP, or should I study both at the same time?
https://redd.it/1ju9wtw
@r_php
Should I learn Node.js first and then switch to PHP, or should I study both at the same time?
https://redd.it/1ju9wtw
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
I had to quickly switch PHP versions for a composer requirement. Then, I got annoyed with all the brew commands, so I wrapped them in a CLI tool.
https://github.com/rawdreeg/phpswitcher
https://redd.it/1juaxyh
@r_php
https://github.com/rawdreeg/phpswitcher
https://redd.it/1juaxyh
@r_php
GitHub
GitHub - rawdreeg/phpswitcher: A simple CLI tool to manage multiple PHP versions on macOS using Homebrew. Linux and Windows support…
A simple CLI tool to manage multiple PHP versions on macOS using Homebrew. Linux and Windows support planned. - rawdreeg/phpswitcher
Laravel package that creates migration files by model definitions. Feedback appreciated
https://github.com/toramanlis/laravel-implicit-migrations
https://redd.it/1ju9zr9
@r_php
https://github.com/toramanlis/laravel-implicit-migrations
https://redd.it/1ju9zr9
@r_php
GitHub
GitHub - toramanlis/laravel-implicit-migrations: This package is a tool that creates Laravel migration files by inspecting the…
This package is a tool that creates Laravel migration files by inspecting the application's models. - toramanlis/laravel-implicit-migrations
Avoid Using SQLite in Development Unless It's Also Used in Production
Using SQLite as the dev database is a trend in the Laravel community nowadays. On the other hand, SQLite was promoted as the default database in the framework. But I’ve experienced unexpected issues with this practice, and I don't want others to face the same.
It might be fine if you only use query builder methods, but even then, there are issues. For instance, if you're familiar with FULLTEXT indexes in MySQL and try to use them in a SQLite dev database, you'll get an error since SQLite doesn't support them. You'll have to take some additional steps like following.
// migrations
if (in_array(DB::connection()->getName(), ['mariadb', 'mysql', 'pgsql'])) {
$table->fullText(['noscript', 'text']);
}
// controllers
if (in_array(DB::connection()->getName(), ['mariadb', 'mysql', 'pgsql'])) {
return $this->builder->whereFullText(['noscript', 'review'], $this->value);
}
If you are developing a large-scale project, you can't limit yourself to using only the query builder especially when you have dashboards. Recently, we shipped a project(uses MySQL in production and SQLite in dev) to production. This was a project with a very limited time frame, so we didn't have much time to plan properly. In fact we rushed to development. Everything worked as expected in the development environment and all tests passed. But then, our clients started reporting server errors. We had to spend a considerable amount of time and effort debugging it since it was so unexpected. At first, we thought it was an issue with our server, but eventually, we found the culprit in the following line.
$query->selectRaw(
"SUM(amount) as amount,
SUM(CASE WHEN type = ? THEN amount END) as infinite,
SUM(CASE WHEN type = ? THEN amount END) as recurring,
strftime('%Y-%m', subscribed_at) AS interval",
[SubnoscriptionType::Infinite->value, SubnoscriptionType::Recurring->value]
);
Can you spot the issue? Don’t worry if you can’t, most of us aren’t DB experts. It was `strftime('%Y-%m', subscribed_at) AS interval`. MySQL doesn’t have a `strftime` function, so we had to change it to MySQL equivalent `DATE_FORMAT(subscribed_at, '%Y-%b') AS \`interval\``.
So the final MySQL equivalent is:
$query->selectRaw(
"SUM(amount) as amount,
SUM(CASE WHEN type = ? THEN amount END) as infinite,
SUM(CASE WHEN type = ? THEN amount END) as recurring,
DATE_FORMAT(subscribed_at, '%Y-%b') AS `interval`",
[SubnoscriptionType::Infinite->value, SubnoscriptionType::Recurring->value]
);
This is just one instance. There are many differences between MySQL and SQLite.
Conclusion: **Use a production database system in development environments**.
Finally we'd better use follow practice: **Use a production-equivalent environment as much as possible in development (not limited to the database)**.
I'd love to hear your thoughts.
https://redd.it/1jubxrg
@r_php
Using SQLite as the dev database is a trend in the Laravel community nowadays. On the other hand, SQLite was promoted as the default database in the framework. But I’ve experienced unexpected issues with this practice, and I don't want others to face the same.
It might be fine if you only use query builder methods, but even then, there are issues. For instance, if you're familiar with FULLTEXT indexes in MySQL and try to use them in a SQLite dev database, you'll get an error since SQLite doesn't support them. You'll have to take some additional steps like following.
// migrations
if (in_array(DB::connection()->getName(), ['mariadb', 'mysql', 'pgsql'])) {
$table->fullText(['noscript', 'text']);
}
// controllers
if (in_array(DB::connection()->getName(), ['mariadb', 'mysql', 'pgsql'])) {
return $this->builder->whereFullText(['noscript', 'review'], $this->value);
}
If you are developing a large-scale project, you can't limit yourself to using only the query builder especially when you have dashboards. Recently, we shipped a project(uses MySQL in production and SQLite in dev) to production. This was a project with a very limited time frame, so we didn't have much time to plan properly. In fact we rushed to development. Everything worked as expected in the development environment and all tests passed. But then, our clients started reporting server errors. We had to spend a considerable amount of time and effort debugging it since it was so unexpected. At first, we thought it was an issue with our server, but eventually, we found the culprit in the following line.
$query->selectRaw(
"SUM(amount) as amount,
SUM(CASE WHEN type = ? THEN amount END) as infinite,
SUM(CASE WHEN type = ? THEN amount END) as recurring,
strftime('%Y-%m', subscribed_at) AS interval",
[SubnoscriptionType::Infinite->value, SubnoscriptionType::Recurring->value]
);
Can you spot the issue? Don’t worry if you can’t, most of us aren’t DB experts. It was `strftime('%Y-%m', subscribed_at) AS interval`. MySQL doesn’t have a `strftime` function, so we had to change it to MySQL equivalent `DATE_FORMAT(subscribed_at, '%Y-%b') AS \`interval\``.
So the final MySQL equivalent is:
$query->selectRaw(
"SUM(amount) as amount,
SUM(CASE WHEN type = ? THEN amount END) as infinite,
SUM(CASE WHEN type = ? THEN amount END) as recurring,
DATE_FORMAT(subscribed_at, '%Y-%b') AS `interval`",
[SubnoscriptionType::Infinite->value, SubnoscriptionType::Recurring->value]
);
This is just one instance. There are many differences between MySQL and SQLite.
Conclusion: **Use a production database system in development environments**.
Finally we'd better use follow practice: **Use a production-equivalent environment as much as possible in development (not limited to the database)**.
I'd love to hear your thoughts.
https://redd.it/1jubxrg
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
Right way to oop with php
Hi, I'm working as a full stack php developer. My job mainly requires procedural style php code. So I'm quite well versed with it.
Now, I have been trying to learn php oop. But no matter how many videos or guides i see, its still confusing.
Main confusion comes from
1. File organization
- should each class be a seperate php file
- should utility class ( sanitization, uppercase, lowercase etc) be all combined in one?
- how to use one class in another class
2. How to create class
- what should constitute a class. Should user be a class defining creation / deletion / modification of users
- what exactly should a constructor of class do ( practically)
I'm still trying to defer mvc architecture for now. In order to understand how the design and flow for oop program should be done
Any and all help with this is helpful. I understand the basics, but having difficulty with irl implementation. Please recommend any guide that helps with implementation rather than basics.
Thanks
https://redd.it/1judmcu
@r_php
Hi, I'm working as a full stack php developer. My job mainly requires procedural style php code. So I'm quite well versed with it.
Now, I have been trying to learn php oop. But no matter how many videos or guides i see, its still confusing.
Main confusion comes from
1. File organization
- should each class be a seperate php file
- should utility class ( sanitization, uppercase, lowercase etc) be all combined in one?
- how to use one class in another class
2. How to create class
- what should constitute a class. Should user be a class defining creation / deletion / modification of users
- what exactly should a constructor of class do ( practically)
I'm still trying to defer mvc architecture for now. In order to understand how the design and flow for oop program should be done
Any and all help with this is helpful. I understand the basics, but having difficulty with irl implementation. Please recommend any guide that helps with implementation rather than basics.
Thanks
https://redd.it/1judmcu
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
SymfonyCon Amsterdam 2025: Last days to enjoy early bird tickets!
https://symfony.com/blog/symfonycon-amsterdam-2025-last-days-to-enjoy-early-bird-tickets?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1ju9vex
@r_php
https://symfony.com/blog/symfonycon-amsterdam-2025-last-days-to-enjoy-early-bird-tickets?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1ju9vex
@r_php
Symfony
SymfonyCon Amsterdam 2025: Last days to enjoy early bird tickets! (Symfony Blog)
Early bird registration for SymfonyCon Amsterdam 2025 ends very shortly (Wednesday, April 9th). Save your seat before the price change!
Laravel package that creates migration files by model definitions. Feedback appreciated
https://github.com/toramanlis/laravel-implicit-migrations
https://redd.it/1juct1e
@r_php
https://github.com/toramanlis/laravel-implicit-migrations
https://redd.it/1juct1e
@r_php
GitHub
GitHub - toramanlis/laravel-implicit-migrations: This package is a tool that creates Laravel migration files by inspecting the…
This package is a tool that creates Laravel migration files by inspecting the application's models. - toramanlis/laravel-implicit-migrations
PHP learning tips for job interview
Hey all, I hope it's okay that I ask this here. Sorry if not :(
I had a job interview last week which went well. Now they want a second meeting with one of their programmers and we will look at some code.
I'm very nervous because I think that I'm not good enough yet.
I have 1 to 1,5 years "experience" in PHP but mainly with Laravel which makes a lot of things pretty easy.
For example I used Laravel Breeze, so Login implementation was always easy and I never learned stuff like this in plain PHP ( never wrote something from scratch ). I still forget a lot of stuff like how to validate requests properly (is this normal?).
I fear that my general PHP knowledge isn't good enough.
I have 2 days left. Do you have recommendations for learning material? On what should I concentrate? Maybe coding principles in general?
What would you expect of a junior full stack developer?
I know you can't know exactly what they want me to do (I don't know either) but any advice would be much appreciated.
https://redd.it/1jurvqm
@r_php
Hey all, I hope it's okay that I ask this here. Sorry if not :(
I had a job interview last week which went well. Now they want a second meeting with one of their programmers and we will look at some code.
I'm very nervous because I think that I'm not good enough yet.
I have 1 to 1,5 years "experience" in PHP but mainly with Laravel which makes a lot of things pretty easy.
For example I used Laravel Breeze, so Login implementation was always easy and I never learned stuff like this in plain PHP ( never wrote something from scratch ). I still forget a lot of stuff like how to validate requests properly (is this normal?).
I fear that my general PHP knowledge isn't good enough.
I have 2 days left. Do you have recommendations for learning material? On what should I concentrate? Maybe coding principles in general?
What would you expect of a junior full stack developer?
I know you can't know exactly what they want me to do (I don't know either) but any advice would be much appreciated.
https://redd.it/1jurvqm
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
NativePHP for desktop v1 is finally here! 🚀
https://github.com/orgs/NativePHP/discussions/547
https://redd.it/1juv61v
@r_php
https://github.com/orgs/NativePHP/discussions/547
https://redd.it/1juv61v
@r_php
GitHub
NativePHP for desktop `v1` is finally here! · NativePHP · Discussion #547
🎉 WE DID IT! We finally got to v1. I almost don't believe it! This is an awesome milestone. For a project that started as just an idea, to see it reach a truly stable place and support building...
Samarium v0.9.5 - Improvements and fixes (Search implemented, npm issues fixed, more DB seeding, more blade components, UI updates)
Hello All,
Made some improvements and fixes during mid March to now to the Laravel and Livewire based project I have been developing. Wanted to share version 0.9.5 with you all.
It is a billing/finance tracking application with ERP like features.
https://github.com/oitcode/samarium
|Area|Improvements|
|:-|:-|
|Search|Basic search implemented for product, sale invoice, customer, vendor, webpages, posts. |
|npm security warning fixes|Updated npm packages so many security warnings during npm install are fixed.|
|Blade components|More blade components. Easier to update all at once now. Still need to create more components.|
|Test Code|Added more test code.|
|Database seeding|There were some issues with the database seeding. It is fixed now.|
|Product display UI updates|UI is update for product display in both admin panel and the website.|
|Misc updates|Sale invoice create minor bug fix, misc updates.|
Dashboard with changed colors
It is a work in progress, but still sharing the update here.
Feedback, comments and/or contributions are highly appreciated.
Thanks.
https://redd.it/1jv00m7
@r_php
Hello All,
Made some improvements and fixes during mid March to now to the Laravel and Livewire based project I have been developing. Wanted to share version 0.9.5 with you all.
It is a billing/finance tracking application with ERP like features.
https://github.com/oitcode/samarium
|Area|Improvements|
|:-|:-|
|Search|Basic search implemented for product, sale invoice, customer, vendor, webpages, posts. |
|npm security warning fixes|Updated npm packages so many security warnings during npm install are fixed.|
|Blade components|More blade components. Easier to update all at once now. Still need to create more components.|
|Test Code|Added more test code.|
|Database seeding|There were some issues with the database seeding. It is fixed now.|
|Product display UI updates|UI is update for product display in both admin panel and the website.|
|Misc updates|Sale invoice create minor bug fix, misc updates.|
Dashboard with changed colors
It is a work in progress, but still sharing the update here.
Feedback, comments and/or contributions are highly appreciated.
Thanks.
https://redd.it/1jv00m7
@r_php
GitHub
GitHub - shyamsitaula/samarium: Open-source business management system with ERP, POS, invoicing, and CMS features. Laravel-based…
Open-source business management system with ERP, POS, invoicing, and CMS features. Laravel-based, Docker-ready. Still in active development. - shyamsitaula/samarium