PHP Reddit – Telegram
PHP Reddit
34 subscribers
289 photos
37 videos
24.8K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
No longer able to pass null into jsondecode?

We are upgrading a legacy web application from 8.0 to 8.1 (I know, don't worry, we're gonna catch up more than that) and I was dismayed to see all over my application a deprecation notice of passing \`null\` as the first argument to \`json\
decode`. A lot of places in our code we seem to be relying on this to fail parsing and return `null` and then checking the results for `is_null`, rather than only parsing if the thing to parse isn't `null`. I kind of get why this change is happening (better typing by only allowing `string` in the argument) and we can update all of our calls to cast the thing we're parsing as a string, but it's quite a bit of disruption.

The reason I'm posting though, is that I can't find any history or discussion of this change anywhere. The official docs for `json_decode` have no mention of the change, and I can't find an RFC or anything. Does anyone have any links they can share?

https://redd.it/1mnlozn
@r_php
How does symfonys autowireing feature differentiates between services and plain classes?

In symfony everything in src can be a service but how does it know which class is a service and which is a plain object that the user wants to instatiate himself?

https://redd.it/1mo1e8b
@r_php
Filament v4 is now stable!

The first stable version of Filament v4 was just released. It brings an enormous amount of new features and improvements. To highlight a few:



Improved table performance
Custom table data
Nested resources
Multi-factor authentication
Unified action classes
Schema components
Dedicated form and table classes
New form fields
Partial rendering
Tailwind CSS v4



Filament v4 also marks a new chapter for Filament Themes, introducing a custom theme designer. There’s way too much to discuss in a single post, so feel free to dig deeper using the links below:



Announcement: [https://filamentphp.com/content/alexandersix-filament-v4-is-stable](https://filamentphp.com/content/alexandersix-filament-v4-is-stable)
Detailed changes: https://filamentphp.com/content/leandrocfe-whats-new-in-filament-v4
GitHub release: [https://github.com/filamentphp/filament/releases/tag/v4.0.0](https://github.com/filamentphp/filament/releases/tag/v4.0.0)
Custom themes: https://filamentthemes.com/themes/custom?utm\_source=reddit&utm\_medium=social&utm\_campaign=custom+themes+early+access



If you want to upgrade right away, check out the upgrade guide with automated upgrade noscript: https://filamentphp.com/docs/4.x/upgrade-guide.

https://redd.it/1mob1xf
@r_php
I built a new PHP Runtime to run PHP applications without Nginx and PHP-FPM

Hey everyone,

Over the past year, I've been building a PHP Application Server called PHPStreamServer.

Think of it as a new way to run PHP applications - no need for Nginx, PHP-FPM, or external GO binaries.

The goal is to bring a runtime to the PHP ecosystem that installs directly via Composer and requires only PHP itself to run.

The cool part is, it's asynchronous. It leverages AMPHP components, making true asynchrony possible in PHP.
This isn't a strict requirement though - you can still run synchronous code, but if you choose to use AMP components, you can take full advantage of async execution.

PHPStreamServer is modular and ships with set of plugins that cover most common needs for PHP apps (except for the core supervisor, which is always included):
- Supervisor (process manager)
- Http Server
- Cron-like Scheduler
- Logger (PSR-3 compatible)
- Prometheus Metrics Server
- File Monitor (auto-reloads the server on file changes)

How is this differs from existing PHP web server implementations like amphp/http-server or Swoole's web server?
Those are bare web server implementations. PHPStreamServer is an application server - it takes care of the entire application lifecycle:
- Deciding how many processes to launch
- Routing requests between processes
- Restarting processes after a crash or a certain condition
- Managing logs
- Providing an interface to manage and monitor the server

In other words, it's not just a way to serve HTTP requests - it's the full runtime environment for PHP applications.

I'd love to hear any thoughts, suggestions, or feature requests.

Website:
https://phpstreamserver.dev/

Github:
https://github.com/phpstreamserver/phpstreamserver/


https://redd.it/1mogmgi
@r_php
Few Laravel packages made by me

**Laravel Locations**

Add models for countries, cities, areas, languages, and currencies to your Laravel application.

Link: https://packagist.org/packages/milenmk/laravel-locations



**Laravel Blacklist**

Implement a filter to block profane and inappropriate words from user input.

Link: https://packagist.org/packages/milenmk/laravel-blacklist



**Laravel GDPR Exporter**

A user data exporter that complies with GDPR regulations and includes support for Livewire.

Link: https://packagist.org/packages/milenmk/laravel-gdpr-exporter



**Email Change Confirmation (in development)**

Enhance the security of the email change process by requiring users to confirm (or deny) the change via an email sent to their current email address.

Link: https://github.com/milenmk/laravel-email-change-confirmation

https://redd.it/1mpj0q0
@r_php
Why isn't PHP as popular if it's used everywhere?

In my opinion, PHP isn't as popular amongst forums, reddit, word of mouth, memes, job listings etc. compared to node/typenoscript. For example the node subreddit has twice as many members, and StackOverflow ranks it much lower in surveys.

However PHP is used 70-80% of the web, which blows my mind, I would have estimated it to be 40% if it wasn't for that statistic.

Why don't more people talk about PHP if it's used more?

https://redd.it/1mpme0p
@r_php
Do you guys have some tips for your first formal project

I'm doing this for my backend specialization. I am a ux-designer so I lean very heavy on brainstorming, finding as many perspectives etc as possible.

Do you guys have anything that you would advise for relating to this subject matter?

https://redd.it/1mpq0it
@r_php
Why should a PHP file always start with that ugly <?php tag ?

No other language has this ugly property. Yes I know, it is from the original 'Personal Home Page' with kinda 'rich HTML' approach in the 00s, but currently HTML code with embedded <? code ?> is very unreadable and barely used anymore.
I hope the PHP community will opt out this some day.

https://redd.it/1mprxiw
@r_php
Best strategies to distribute a PHP app in a container

There are many tutorials out there about building dev envs for PHP applications with Docker, or deploying them to container-based platforms.

But when it comes to distributing a containerized PHP application, the available information is rather scarce.

So I'm asking here.

Let say for example we need to distribute a Laravel or Symfony application as a Docker container. The user then need to download the container, run Composer and other install noscripts, provide some config options for the .env file, and some config files, before he can run the application.

How to do that easily? Passing options to the Docker cli or in Docker Compose might not be sufficient, since some config files might need for example to be populated with arrays of options.

https://redd.it/1mq53si
@r_php
ConvertEmptyStringsToNull is garbage magic and I feel crazy

Guess I'm late to the party but while clearing out some legacy junk from a Laravel app I've just today realized that.... Laravel includes ConvertEmptyStringsToNull middleware globally by default. That's insane. Have we learned nothing from the great magic_quotes_gpc debacle of the early 2000's? Magic is bad, mkay? You might find it handy but it comes back to bite you in the butt, mkay?

I get it, you want to send your empty form inputs directly to your nullable database columns as easily as possible. Cool. What happens when you're using a POST value for literally anything else? What happens when you actually have a logical use case for empty-string versus null?

"Bro, just disable it for the attributes you want." NO. I got a better idea. Turn that shit OFF by default and ENABLE it where null is important. Don't ASSUME everyone wants the same magic. It's a bad idea. Yes, I know I can disable it completely, and I've done that. So I'm fine, just disappointed that it's on by default. It makes Laravel look dumb and it teaches bad habits. Arrrrgh!

Thank you for coming to my ~~Ted~~ Laracon Talk.

https://redd.it/1mqejhp
@r_php
Simple, fully customizable CMS for single-page site

I’m creating a single-page site, and I’m looking for a simple, free and open-source CMS that is fully customizable. Editing the page should be easy and intuitive for a non-technical person (the site owner). It should be based on PHP (no Node.js or database) and be runnable on XAMPP. If possible, I want to use my existing HTML/CSS/JavaScript code (including media queries and the carousel library). Any recommendations?

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