How to Change Algorithms in Symfony without Code Modifications: The Strategy Pattern
https://ngandu.hashnode.dev/symfony-strategy-design-pattern
https://redd.it/1nnk87w
@r_php
https://ngandu.hashnode.dev/symfony-strategy-design-pattern
https://redd.it/1nnk87w
@r_php
SymfonyCon Amsterdam 2025: Strategic DDD
https://symfony.com/blog/symfonycon-amsterdam-2025-strategic-ddd?utm_medium=feed&utm_source=Symfony%20Blog%20Feed
https://redd.it/1nnn2rb
@r_php
https://symfony.com/blog/symfonycon-amsterdam-2025-strategic-ddd?utm_medium=feed&utm_source=Symfony%20Blog%20Feed
https://redd.it/1nnn2rb
@r_php
Symfony
SymfonyCon Amsterdam 2025: Strategic DDD (Symfony Blog)
Join Rob Allen to explore the strategic side of Domain Driven Design—and learn how better communication can turn business needs into truly maintainable software.
A simple package adding a validation rule to detect spammy input
Sifter
I've got a couple of side-projects that use the standard Laravel registration form, and I noticed everyday would be a few users created where the name field was like "GEbCeZlhiT" and "XpNGxMfw"... obvious spam. My first step was a simple honeypot using a 'phone number' field... but no luck. Then, on one of the sites, I added a Cloudflare captcha widget... and even then, I'd get a couple that would come through.
Since very few people have more than 2 or 3 capital letters in their name, I created my own validation rule. That got rid of a few more. Then I recreated one to check for names with no vowels, or lots of consonants without what I'd consider enough vowels.
Finally, I wrapped them all up in a single, configurable validation rule. And this is it.
As I note in the readme, this a brute-force validation -- I still get spam accounts where the random characters just happen to pass, it's just down 1 every couple of weeks instead of multiple a day. And if a "real" person mashes keys because they don't want to give their real name, they'll get a 404 page. Since these are for side projects of mine, it's a tradeoff I'm ok with.
Feel free to check it out, if it's something you've noticed. And it's all configurable, so you can toggle on/off the rules or even create your own.
https://redd.it/1nnq80g
@r_php
Sifter
I've got a couple of side-projects that use the standard Laravel registration form, and I noticed everyday would be a few users created where the name field was like "GEbCeZlhiT" and "XpNGxMfw"... obvious spam. My first step was a simple honeypot using a 'phone number' field... but no luck. Then, on one of the sites, I added a Cloudflare captcha widget... and even then, I'd get a couple that would come through.
Since very few people have more than 2 or 3 capital letters in their name, I created my own validation rule. That got rid of a few more. Then I recreated one to check for names with no vowels, or lots of consonants without what I'd consider enough vowels.
Finally, I wrapped them all up in a single, configurable validation rule. And this is it.
As I note in the readme, this a brute-force validation -- I still get spam accounts where the random characters just happen to pass, it's just down 1 every couple of weeks instead of multiple a day. And if a "real" person mashes keys because they don't want to give their real name, they'll get a 404 page. Since these are for side projects of mine, it's a tradeoff I'm ok with.
Feel free to check it out, if it's something you've noticed. And it's all configurable, so you can toggle on/off the rules or even create your own.
https://redd.it/1nnq80g
@r_php
packagist.org
matula/sifter - Packagist
Detect spammy input on Laravel forms
In 20 years this is my favourite function that I've ever written.
function dateSuffix($x){
$s = [0,"st","nd","rd"];
return (in_array($x,[1,2,3,21,22,23,31])) ? $s[$x % 10] : "th";
}
https://redd.it/1nnu6tj
@r_php
function dateSuffix($x){
$s = [0,"st","nd","rd"];
return (in_array($x,[1,2,3,21,22,23,31])) ? $s[$x % 10] : "th";
}
https://redd.it/1nnu6tj
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Multi-Agent Systems in PHP: A Practical Deep Research Implementation
https://inspector.dev/multi-agent-systems-in-php-a-practical-deep-research-implementation/
https://redd.it/1nnv91o
@r_php
https://inspector.dev/multi-agent-systems-in-php-a-practical-deep-research-implementation/
https://redd.it/1nnv91o
@r_php
Inspector
Multi-Agent Systems in PHP: A Practical Deep Research Implementation
Learn to build sophisticated multi-agent AI systems in PHP using Neuron's event-driven workflows and real-time streaming capabilities.
Novel SQL Injection Technique in PDO Prepared Statements
https://slcyber.io/assetnote-security-research-center/a-novel-technique-for-sql-injection-in-pdos-prepared-statements/
https://redd.it/1no41lk
@r_php
https://slcyber.io/assetnote-security-research-center/a-novel-technique-for-sql-injection-in-pdos-prepared-statements/
https://redd.it/1no41lk
@r_php
Searchlight Cyber
Novel SQL Injection Technique in PDO Prepared Statements
Searchlight Cyber's Security Research team details a Novel Technique for SQL Injection in PDO's Prepared Statements.
Free Performance Boost
We switched from PHP-FPM to Nginx Unit to juice out more performance out of our apps, and it’s actually much faster. Not as fast as Octane, but still enough for us to terminate about 40% of the servers the app was running.
Just a heads up for people. It also behaves like FPM, no need to adapt your service controllers like Octane requires you to.
I don’t exactly know why Unit is much, much faster, but it works really well.
https://redd.it/1no963s
@r_php
We switched from PHP-FPM to Nginx Unit to juice out more performance out of our apps, and it’s actually much faster. Not as fast as Octane, but still enough for us to terminate about 40% of the servers the app was running.
Just a heads up for people. It also behaves like FPM, no need to adapt your service controllers like Octane requires you to.
I don’t exactly know why Unit is much, much faster, but it works really well.
https://redd.it/1no963s
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
How to Prepare for a 2 Hour Full Stack Developer Technical Interview
https://www.getmakedigital.com/blogs/dev-careers/fullstack-interview-guide
https://redd.it/1noeub1
@r_php
https://www.getmakedigital.com/blogs/dev-careers/fullstack-interview-guide
https://redd.it/1noeub1
@r_php
Getmakedigital
How to Prepare for a 2 Hour Full Stack Developer Technical Interview
Learn how to effectively prepare for a 2 hour full stack developer technical interview, covering behavioral questions, coding exercises, and essential technical skills.
SymfonyCon Amsterdam 2025: Rediscover the Console
https://symfony.com/blog/symfonycon-amsterdam-2025-rediscover-the-console?utm_medium=feed&utm_source=Symfony%20Blog%20Feed
https://redd.it/1nohzpp
@r_php
https://symfony.com/blog/symfonycon-amsterdam-2025-rediscover-the-console?utm_medium=feed&utm_source=Symfony%20Blog%20Feed
https://redd.it/1nohzpp
@r_php
Symfony
SymfonyCon Amsterdam 2025: Rediscover the Console (Symfony Blog)
💻 Join Robin Chalas to explore Symfony’s most ubiquitous component, its brand-new redesign in 7.3, and the possibilities it unlocks for the future!
Media is too big
VIEW IN TELEGRAM
FilaForms - Native Filament form builder I built (visual builder, submissions, notifications, analytics)
https://redd.it/1nomon2
@r_php
https://redd.it/1nomon2
@r_php
In 20 years this is most surprisingly useful function I've written.
Inspired by the other post. This is a function that at first shouldn't be necessary (sql usually sorts well),
but it has proven surprisingly useful. d_sortarray() is basically collator_asort (EDIT: sorts by users language!)
# sorts a query result, fieldname can be an array
# example : d_sortresults($query_result, 'percentage', $num_rows);
function d_sortresults(array &$qA, $fieldname, $num)
{
$copyA = $qA;
for ($i = 0; $i < $num; $i++)
{
if (is_array($fieldname))
{
$tosortA[$i] = '';
foreach($fieldname as $part)
{
$tosortA[$i] .= $qA[$i][$part];
}
}
else
{
$tosortA[$i] = $qA[$i][$fieldname];
}
}
if (isset($tosortA) && is_array($tosortA))
{
d_sortarray($tosortA);
$i = -1;
foreach($tosortA as $key => $v)
{
$i++;
$qA[$i] = $copyA[$key];
}
}
}
https://redd.it/1nolui6
@r_php
Inspired by the other post. This is a function that at first shouldn't be necessary (sql usually sorts well),
but it has proven surprisingly useful. d_sortarray() is basically collator_asort (EDIT: sorts by users language!)
# sorts a query result, fieldname can be an array
# example : d_sortresults($query_result, 'percentage', $num_rows);
function d_sortresults(array &$qA, $fieldname, $num)
{
$copyA = $qA;
for ($i = 0; $i < $num; $i++)
{
if (is_array($fieldname))
{
$tosortA[$i] = '';
foreach($fieldname as $part)
{
$tosortA[$i] .= $qA[$i][$part];
}
}
else
{
$tosortA[$i] = $qA[$i][$fieldname];
}
}
if (isset($tosortA) && is_array($tosortA))
{
d_sortarray($tosortA);
$i = -1;
foreach($tosortA as $key => $v)
{
$i++;
$qA[$i] = $copyA[$key];
}
}
}
https://redd.it/1nolui6
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
A Call for Sustainable Open Source Infrastructure
https://blog.packagist.com/a-call-for-sustainable-open-source-infrastructure/
https://redd.it/1noq6q1
@r_php
https://blog.packagist.com/a-call-for-sustainable-open-source-infrastructure/
https://redd.it/1noq6q1
@r_php
Private Packagist
A Call for Sustainable Open Source Infrastructure
Today, we joined other major package registries in signing an important joint statement on sustainable stewardship of open source infrastructure. Together with Maven Central, PyPI, crates.io, Open VSX, OpenJS Foundation, OpenSSF and Alpha-Omega, we're addressing…
Anyone have experience with MailCoach?
Curious if anyone has used MailCoach (https://www.mailcoach.app) before.
We have a SaaS product currently and are thinking about building in some email marketing as an additional product offering.
I’d love to use MailCoach + AWS SES/SendGrid/MailGun and call it a day, but curious how realistic it is or if anyone has had good experiences with it as far as ease of use and deliverability.
I know a lot of people will say “don’t do this” and “just use MailChimp”. I understand the headache I’m about to embark on, but I’m hoping I can ease the burden by leveraging existing tools and mail providers to handle load balancing, blacklisting, etc.
Thanks in advance!
https://redd.it/1np0vjw
@r_php
Curious if anyone has used MailCoach (https://www.mailcoach.app) before.
We have a SaaS product currently and are thinking about building in some email marketing as an additional product offering.
I’d love to use MailCoach + AWS SES/SendGrid/MailGun and call it a day, but curious how realistic it is or if anyone has had good experiences with it as far as ease of use and deliverability.
I know a lot of people will say “don’t do this” and “just use MailChimp”. I understand the headache I’m about to embark on, but I’m hoping I can ease the burden by leveraging existing tools and mail providers to handle load balancing, blacklisting, etc.
Thanks in advance!
https://redd.it/1np0vjw
@r_php
www.mailcoach.app
Mailcoach - Powerful email marketing tools
Everything you need to start sending newsletters, drip campaigns, transactional emails. Mailcoach is a fully featured email marketing platform built for growing creators, developers, and businesses.
Scandir() and links.
Trying to create links on my local machine. but browser said none exist or sth.
here's my code:
<?php
$mydir = 'g:\movies';
$myfiles = scandir($mydir);
foreach ($myfiles as $dafile){
print_r($dafile);
echo "<br>";
}
include('starwars.html');
foreach ($myfiles as $result) {
echo "<a href=\"$result\">$result</a>";
echo "<br>";
}
?>
What am I missing here ---> \"$result\"
My desired goal is to style these links to open movie files, music files, etc. It is a learning phase for me. so please bear with me.
Suggestions please!
https://redd.it/1npa9dg
@r_php
Trying to create links on my local machine. but browser said none exist or sth.
here's my code:
<?php
$mydir = 'g:\movies';
$myfiles = scandir($mydir);
foreach ($myfiles as $dafile){
print_r($dafile);
echo "<br>";
}
include('starwars.html');
foreach ($myfiles as $result) {
echo "<a href=\"$result\">$result</a>";
echo "<br>";
}
?>
What am I missing here ---> \"$result\"
My desired goal is to style these links to open movie files, music files, etc. It is a learning phase for me. so please bear with me.
Suggestions please!
https://redd.it/1npa9dg
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
PHP perception at a CTO panel
Was in a conference where 90% of the audience were CTOs and Director level. During a panel a shocking phrase was said.
"some people didn't embrace change and are stuck with ancient technologies and ideas such as Perl or PHP".
It struck me!
If you are a CTO at a company that uses PHP, please go out at any conference and advocate for it!
https://redd.it/1npb1cn
@r_php
Was in a conference where 90% of the audience were CTOs and Director level. During a panel a shocking phrase was said.
"some people didn't embrace change and are stuck with ancient technologies and ideas such as Perl or PHP".
It struck me!
If you are a CTO at a company that uses PHP, please go out at any conference and advocate for it!
https://redd.it/1npb1cn
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Firewalls underexplained in docs?
I am working on app that has multiple firewalls, one of which has switchuser functionality. I currently have an issue where on switching the user I get access denied on one route and 200 on another, both handled by same firewall.
I wanted to read upon firewall concept a bit more in Symfony docs, but basically what I see is that one of the core concepts has basically a parapgraph, saying.
Firewall:
1. Most important aspect of auth
2. Only one firewall per request
3. Oh and there is fake dummy firewall for profiler, don't worry
What about how the individual firewall contexts are stored if I have multiple firewalls, what happens if I login to one firewall and then try to login to another one... ? What about switch user specifics when one firewall has switch user functionality enabled and then another does not, but switch user redirect goes to another firewall... ?
There is a mention that if you login from one firewall, by default your are logged out from all of them, which is also interesting.
In summary it feels like docs do not provide the broader concept of how think about multiple firewall interaction.
https://redd.it/1npcyeb
@r_php
I am working on app that has multiple firewalls, one of which has switchuser functionality. I currently have an issue where on switching the user I get access denied on one route and 200 on another, both handled by same firewall.
I wanted to read upon firewall concept a bit more in Symfony docs, but basically what I see is that one of the core concepts has basically a parapgraph, saying.
Firewall:
1. Most important aspect of auth
2. Only one firewall per request
3. Oh and there is fake dummy firewall for profiler, don't worry
What about how the individual firewall contexts are stored if I have multiple firewalls, what happens if I login to one firewall and then try to login to another one... ? What about switch user specifics when one firewall has switch user functionality enabled and then another does not, but switch user redirect goes to another firewall... ?
There is a mention that if you login from one firewall, by default your are logged out from all of them, which is also interesting.
In summary it feels like docs do not provide the broader concept of how think about multiple firewall interaction.
https://redd.it/1npcyeb
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
Povilas Korop: Cursor, PHPStorm, Livewire, React, Vue, AI & PHP Tooling!
https://youtu.be/Uwl5WDvNbhM?si=RH5jA5A6ZazwuybB
https://redd.it/1npcp5f
@r_php
https://youtu.be/Uwl5WDvNbhM?si=RH5jA5A6ZazwuybB
https://redd.it/1npcp5f
@r_php
YouTube
Povilas Korop: Cursor, PHPStorm, Livewire, React, Vue, AI & PHP Tooling!
❤️ sponsor this channel: https://nunomaduro.com/sponsorships 🙌🏻 this video was made possible by:
💎 laracasts / the best way to learn laravel and php: https://laracasts.com/?ref=nunomaduro
🐰 coderabbit / ai code reviews with instant feedback on pull requests:…
💎 laracasts / the best way to learn laravel and php: https://laracasts.com/?ref=nunomaduro
🐰 coderabbit / ai code reviews with instant feedback on pull requests:…
Performance issues on large PHP application
I have a very large PHP application hosted on AWS which is experiencing performance issues for customers that bring the site to an unusable state.
The cache is on Redis/Valkey in ElastiCache and the database is PostgreSQL (RDS).
I’ve blocked a whole bunch of bots, via a WAF, and attempts to access blocked URLs.
The sites are running on Nginx and php-fpm.
When I look through the php-fpm log I can see a bunch of noscripts that exceed a timeout at around 30s. There’s no pattern to these noscripts, unfortunately. I also cannot see any errors related to the max_children (25) being too low, so it doesn’t make me think they need increased but I’m no php-fpm expert.
I’ve checked the redis-cli stats and can’t see any issues jumping out at me and I’m now at a stage where I don’t know where to look.
Does anyone have any advice on where to look next as I’m at a complete loss.
https://redd.it/1npap6n
@r_php
I have a very large PHP application hosted on AWS which is experiencing performance issues for customers that bring the site to an unusable state.
The cache is on Redis/Valkey in ElastiCache and the database is PostgreSQL (RDS).
I’ve blocked a whole bunch of bots, via a WAF, and attempts to access blocked URLs.
The sites are running on Nginx and php-fpm.
When I look through the php-fpm log I can see a bunch of noscripts that exceed a timeout at around 30s. There’s no pattern to these noscripts, unfortunately. I also cannot see any errors related to the max_children (25) being too low, so it doesn’t make me think they need increased but I’m no php-fpm expert.
I’ve checked the redis-cli stats and can’t see any issues jumping out at me and I’m now at a stage where I don’t know where to look.
Does anyone have any advice on where to look next as I’m at a complete loss.
https://redd.it/1npap6n
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community