[Update] Laravel AI Translator: Gemini Support + Parallel Translations!
https://kargn.as/projects/laravel-ai-translator
https://redd.it/1koymxw
@r_php
https://kargn.as/projects/laravel-ai-translator
https://redd.it/1koymxw
@r_php
Authenticatable: shouldn't the interfaces be thinner?
Recently I've been working on an advanced authentication and identity management system for one of my projects. It includes managing users through different drivers, sources, stores, and authentication methods. Some of the users might have roles, others are SSO, etc. In other words - maximum versatility.
To begin with, I must admit that Laravel provides a flexible enough system that allowed me to connect everything together: multiple stores (providers) (relational, no-SQL, and in-memory), including external SSOs. So, that's on the positive side.
However, I faced a huge challenge when working with one particular interface (contract) -
Distinct functions include:
1. Identify the
2. Getting the password;
3. "Remember me" functionality (getting, setting and rotation of the "remember me" token)
What kind of problems I faced:
1. Not all users have passwords, in particular - SSO.
2. Not all users have "remember me" - when I authenticate users using bearer token (JWT). They don't have passwords either.
3. The "overhead" or "concrete methods" for UsersProvider,
Since I want to integrate my users into the authentication system of the framework, I have to implement the provided interface (
What do you think?
https://redd.it/1kp5dhv
@r_php
Recently I've been working on an advanced authentication and identity management system for one of my projects. It includes managing users through different drivers, sources, stores, and authentication methods. Some of the users might have roles, others are SSO, etc. In other words - maximum versatility.
To begin with, I must admit that Laravel provides a flexible enough system that allowed me to connect everything together: multiple stores (providers) (relational, no-SQL, and in-memory), including external SSOs. So, that's on the positive side.
However, I faced a huge challenge when working with one particular interface (contract) -
Authenticatable (Illuminate\Contracts\Auth\Authenticatable). Basically, it's HUGE. You could check the source; at the current state, it's responsible for at least 3 different (distinct) functions and has little overhead, or "concrete" implementation (if that's allowed to say about an interface).Distinct functions include:
1. Identify the
Authenticatable subject;2. Getting the password;
3. "Remember me" functionality (getting, setting and rotation of the "remember me" token)
What kind of problems I faced:
1. Not all users have passwords, in particular - SSO.
2. Not all users have "remember me" - when I authenticate users using bearer token (JWT). They don't have passwords either.
3. The "overhead" or "concrete methods" for UsersProvider,
getAuthIdentifierName \- is also not applicable to SSO / JWT users. The getAuthIdentifierName basically returns the "column name" or the "key name", of the identifier, while there is a dedicated method getAuthIdentifier that returns just the identifier.Since I want to integrate my users into the authentication system of the framework, I have to implement the provided interface (
Authenticatable), which led me to having most of the methods for different users empty or return null. This led me to question why one of the primary interfaces of the authentication system has so many methods that are not relevant to non-default cases (using SessionGuard with Eloquent UsersProvider). It felt like someone just took the "User" class and converted it into a contract (interface).What do you think?
https://redd.it/1kp5dhv
@r_php
GitHub
framework/src/Illuminate/Auth/Authenticatable.php at master · laravel/framework
The Laravel Framework. Contribute to laravel/framework development by creating an account on GitHub.
Is there any tool that changes PHP's syntax?
Like a tool that would let me write $this.variable and it converts it to $this->variable
https://redd.it/1kp9g7k
@r_php
Like a tool that would let me write $this.variable and it converts it to $this->variable
https://redd.it/1kp9g7k
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
A Week of Symfony #959 (May 12–18, 2025)
https://symfony.com/blog/a-week-of-symfony-959-may-12-18-2025?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1kpfmaa
@r_php
https://symfony.com/blog/a-week-of-symfony-959-may-12-18-2025?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1kpfmaa
@r_php
Symfony
A Week of Symfony #959 (May 12–18, 2025) (Symfony Blog)
This week, development activity focused on polishing Symfony 7.3 ahead of its final release in two weeks. We also continued publishing articles highlighting the new features of Symfony 7.3 and shared …
Two or fewer method/function arguments still ideal
What would you say, is the recommendation to give a method or function as few - in the best case two or fewer - arguments as possible still up to date?
I can understand that it is generally always better to use as few arguments as possible. However, this is often not feasible in practice.
I can also understand that before PHP 8, before named arguments existed, it was just ugly to pre-fill unused arguments.
See the following example function:
function font(string $file, string $color = '#000000',int $size = 12, float $lineHeight = 1, int $rotation = 0)
{
//
}
All arguments had to be filled before PHP 8 in order to create a default font with 90 degree rotation in the example.
// before PHP 8
$font = font('Example.ttf', '#000000', 12, 1, 90);
With PHP 8 there are fortunately named arguments:
// after PHP 8
$font = font('Example.ttf', rotation: 90);
This of course improves readability immensely. For this reason, I would say that there is not necessarily a reason to follow this recommendation. Of course, it still makes sense to split the arguments into higher-level objects if applicable. But not at all costs.
As long as there are only 1 or 2 without a default value, readability should still be guaranteed with named arguments. What do you think?
https://redd.it/1kpi29s
@r_php
What would you say, is the recommendation to give a method or function as few - in the best case two or fewer - arguments as possible still up to date?
I can understand that it is generally always better to use as few arguments as possible. However, this is often not feasible in practice.
I can also understand that before PHP 8, before named arguments existed, it was just ugly to pre-fill unused arguments.
See the following example function:
function font(string $file, string $color = '#000000',int $size = 12, float $lineHeight = 1, int $rotation = 0)
{
//
}
All arguments had to be filled before PHP 8 in order to create a default font with 90 degree rotation in the example.
// before PHP 8
$font = font('Example.ttf', '#000000', 12, 1, 90);
With PHP 8 there are fortunately named arguments:
// after PHP 8
$font = font('Example.ttf', rotation: 90);
This of course improves readability immensely. For this reason, I would say that there is not necessarily a reason to follow this recommendation. Of course, it still makes sense to split the arguments into higher-level objects if applicable. But not at all costs.
As long as there are only 1 or 2 without a default value, readability should still be guaranteed with named arguments. What do you think?
https://redd.it/1kpi29s
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Introspect for Laravel - Query your codebase like a database with an Eloquent-like API
https://redd.it/1kpoz7z
@r_php
https://redd.it/1kpoz7z
@r_php
The Laralist #58: Pipe operator v3 ➡️, Big improvements to Laravel Echo ⚡, Arr typed helpers 💡, FrankenPHP Is Now Officially Supported by The PHP Foundation 🧟, How Cursor Indexes Codebases Fast 🗂️
https://thelaralist.com/archive/9eef9045-6ba5-4dc4-a9a3-7280973add48
https://redd.it/1kpq25r
@r_php
https://thelaralist.com/archive/9eef9045-6ba5-4dc4-a9a3-7280973add48
https://redd.it/1kpq25r
@r_php
Thelaralist
RFC: Pipe operator v3 ➡️, Big improvements to Laravel Echo ⚡, Arr typed helpers 💡, FrankenPHP Is Now Officially Supported by …
The PHP RFC introduces a "pipe" operator `|>`, facilitating function chaining by passing the left-side value as the first parameter to a single-parameter callable on the right.
Voting so far is favorable, so the proposal will likely be accepted.
Voting so far is favorable, so the proposal will likely be accepted.
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/1kpoq5b
@r_php
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/1kpoq5b
@r_php
Laravel
Installation - Laravel 12.x - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Weekly Ask Anything Thread
Feel free to ask any questions you think may not warrant a post. Asking for help here is also fine.
https://redd.it/1kq1t0a
@r_php
Feel free to ask any questions you think may not warrant a post. Asking for help here is also fine.
https://redd.it/1kq1t0a
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
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/1kq4h8w
@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/1kq4h8w
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Who's hiring/looking
This is a bi-monthly thread aimed to connect PHP companies and developers who are hiring or looking for a job.
Rules
No recruiters
Don't share any personal info like email addresses or phone numbers in this thread. Contact each other via DM to get in touch
If you're hiring: don't just link to an external website, take the time to describe what you're looking for in the thread.
If you're looking: feel free to share your portfolio, GitHub, … as well. Keep into account the personal information rule, so don't just share your CV and be done with it.
https://redd.it/1kq67pi
@r_php
This is a bi-monthly thread aimed to connect PHP companies and developers who are hiring or looking for a job.
Rules
No recruiters
Don't share any personal info like email addresses or phone numbers in this thread. Contact each other via DM to get in touch
If you're hiring: don't just link to an external website, take the time to describe what you're looking for in the thread.
If you're looking: feel free to share your portfolio, GitHub, … as well. Keep into account the personal information rule, so don't just share your CV and be done with it.
https://redd.it/1kq67pi
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
New in Symfony 7.3: Yaml Improvements
https://symfony.com/blog/new-in-symfony-7-3-yaml-improvements?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1kq70bm
@r_php
https://symfony.com/blog/new-in-symfony-7-3-yaml-improvements?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1kq70bm
@r_php
Symfony
New in Symfony 7.3: Yaml Improvements (Symfony Blog)
Symfony 7.3 adds YAML flags to force quoted strings, compact nested maps, and dump empty entries.
Do not call toArray() to get all items from a Laravel Collection
https://spatie.be/blog/do-not-call-toarray-to-get-all-items-from-a-laravel-collection
https://redd.it/1kq5rxc
@r_php
https://spatie.be/blog/do-not-call-toarray-to-get-all-items-from-a-laravel-collection
https://redd.it/1kq5rxc
@r_php
spatie.be
Do not call toArray() to get all items from a Laravel Collection
Laravel's toArray collection method might not return what you might expect.
Symfony UX CVE-2025-47946: Unsanitized HTML attribute injection via ComponentAttributes
https://symfony.com/blog/symfony-ux-cve-2025-47946-unsanitized-html-attribute-injection-via-componentattributes?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1kqb2ls
@r_php
https://symfony.com/blog/symfony-ux-cve-2025-47946-unsanitized-html-attribute-injection-via-componentattributes?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1kqb2ls
@r_php
Symfony
Symfony UX CVE-2025-47946: Unsanitized HTML attribute injection via ComponentAttributes (Symfony Blog)
PHP on macos
Hi guys,
I was curious in what way you have PHP running locally. Currently using XAMPP but got a new macbook and wanted to a clean proper install.
Its for a custom PHP framework.
What would you recommend and why?
https://redd.it/1kqauqj
@r_php
Hi guys,
I was curious in what way you have PHP running locally. Currently using XAMPP but got a new macbook and wanted to a clean proper install.
Its for a custom PHP framework.
What would you recommend and why?
https://redd.it/1kqauqj
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Moving application logic out of livewire components to service classes. Used service classes to delete records.
Hello All,
I have posted here before about the project I have been working on for some time and have got some valuable feedback suggestions from you all.
I had got suggestion here to move the application/business logic from livewire components to service classes. I followed the pattern, and now have implemented delete functionality for most of the records using service classes.
As a whole, moving the application/business logic from livewire component to service classes feels much more cleaner than before. Having business logic in a service classes has given more freedom to call these services from any controller or livewire components.
Here is the github repo.
https://github.com/oitcode/samarium
More work/code is required to move most of the application logic from livewire components to service classes, but for now I have implemented deletion of records at least.
Worked some time on this, so sharing here, also thanks to all who suggested this change.
Thanks.
https://redd.it/1kqfdha
@r_php
Hello All,
I have posted here before about the project I have been working on for some time and have got some valuable feedback suggestions from you all.
I had got suggestion here to move the application/business logic from livewire components to service classes. I followed the pattern, and now have implemented delete functionality for most of the records using service classes.
As a whole, moving the application/business logic from livewire component to service classes feels much more cleaner than before. Having business logic in a service classes has given more freedom to call these services from any controller or livewire components.
Here is the github repo.
https://github.com/oitcode/samarium
More work/code is required to move most of the application logic from livewire components to service classes, but for now I have implemented deletion of records at least.
Worked some time on this, so sharing here, also thanks to all who suggested this change.
Thanks.
https://redd.it/1kqfdha
@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
Frankenstein Migration: Mojavi to Symfony
I have a web application, that I currently maintain, that is a frankenstein of beast. As far as I can tell there are two php frameworks in this project, Mojavi 2.0 and Symfony 4.4, and I need to migrate it to one. It was originally built on Mojavi and then at some point someone added Symfony 4.4 but never fully migrated it.
I can't find any documentation on Mojavi. The only info I can get is from ChatGPT...and that was only helpful in understanding the structure. I want to do a phased rewrite to 6.4 or 7 but my boss is against it and thinks updating to 4.4 should be easy.
If anyone has experience with this kind of migration, can you help. With either how to refactor the code in Mojavi to Symfony 4 or convincing my boss to the rewrite.
https://redd.it/1kqhprb
@r_php
I have a web application, that I currently maintain, that is a frankenstein of beast. As far as I can tell there are two php frameworks in this project, Mojavi 2.0 and Symfony 4.4, and I need to migrate it to one. It was originally built on Mojavi and then at some point someone added Symfony 4.4 but never fully migrated it.
I can't find any documentation on Mojavi. The only info I can get is from ChatGPT...and that was only helpful in understanding the structure. I want to do a phased rewrite to 6.4 or 7 but my boss is against it and thinks updating to 4.4 should be easy.
If anyone has experience with this kind of migration, can you help. With either how to refactor the code in Mojavi to Symfony 4 or convincing my boss to the rewrite.
https://redd.it/1kqhprb
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
My 10-minute overview of the upcoming pipe operator 🤩
https://www.youtube.com/watch?v=UG_yb_WOutE
https://redd.it/1kqy4dn
@r_php
https://www.youtube.com/watch?v=UG_yb_WOutE
https://redd.it/1kqy4dn
@r_php
YouTube
An overview of PHP 8.5's pipe operator
PHP 8.5 will introduce a new pipe operator, let's take a look at how it works!
#php
#php
New in Symfony 7.3: JsonStreamer Component
https://symfony.com/blog/new-in-symfony-7-3-jsonstreamer-component?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1kr07ij
@r_php
https://symfony.com/blog/new-in-symfony-7-3-jsonstreamer-component?utm_source=Symfony%20Blog%20Feed&utm_medium=feed
https://redd.it/1kr07ij
@r_php
Symfony
New in Symfony 7.3: JsonStreamer Component (Symfony Blog)
In Symfony 7.3, the new JsonStreamer component provides a high-performance, low-memory solution for encoding and decoding JSON at scale.