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
How do you use twig live components?

I really like using Twig Live Components to make a page interactive, so my whole page is a Live Component. This makes communication between properties and updating state really easy.
But is this a misuse of Live Components, since they are typically meant to be smaller components that compose the page, not the whole page itself? So currently in my Project the twig Template rendered by the controller is just a wrapper for one twig live component that contains all the HTML separated by includes.

I tried separating one page into smaller Live Components, but the overhead of adding so many events for communication between them just doesn’t seem worth it to me.
I just want to hear your opinion on how you use Live Components and how they should be used.

https://redd.it/1mm31b5
@r_php
What is your opinion about Ziggy in Interia applications?

I have started developing an application using Laravel and InertiaJS a few months ago. At this time I bootstrapped the project with one of the Laravel starter templates. By default this templates come with Ziggy preinstalled. My first thought was: cool feature, so I don't have to reference the paths directly in the client-side navigation, but can fall back on the route names.

As the application has grown and more and more routes have been added, I have become increasingly concerned about performance and security. Each Interia Response contains a ziggy object with all routes of my application.

The object includes routes to sensitive parts of the application like admin area, horizon etc. These routes are specially secured, but I still think that not every user should know about them.
Due to the growing number of routes, the Ziggy object is currently 170kb in size. This means that every Interia Response is 170kb larger than it needs to be. I think that even with a small number of users, this quickly adds up.

What is your opinion on this? Do you still use Ziggy despite these drawbacks?

https://redd.it/1mmfekn
@r_php
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/1mmnsnr
@r_php
I made a neovim plugin to use psysh without leaving my editor (php-tinker.nvim)

Hey all,

I've got a new plugin for the 4 of you using neovim to write PHP.

psysh and Tinkerwell are great REPLs, but none of them have my ~~cursed~~beloved custom vim keymaps. However, thanks to Saeed Vaziry's work on TweakPHP and its client, this plugin gives you the power of all the aforementioned tools right in Neovim!

From any Symfony, WordPress, Laravel, or any Composer-autoloaded project, you can test out your janky code right from your editor without opening your browser or opening a separate terminal window.

There's not much more to it than that: it's psysh in Neovim! Check out the plugin repo to get started.

https://redd.it/1mmo60c
@r_php
I made a neovim plugin to use artisan tinker without leaving my keymaps behind (php-tinker.nvim)

Hey all,

I've got a new plugin for the 4 of you using neovim to build Laravel apps.

psysh, php artisan tinker, and Tinkerwell are all great REPLs, but none of them have my ~~cursed~~beloved custom vim keymaps. However, thanks to Saeed Vaziry's work on TweakPHP and its client, this plugin gives you the power of all the aforementioned tools right in Neovim!

From any Laravel project (or any Composer-autoloaded project) you can test out your janky code or accidentally create 5000 fake users right from your editor without opening your browser or running your console command 30 times.

There's not much more to it than that: it's psysh in Neovim! Check out the plugin repo to get started.

https://redd.it/1mmo5y7
@r_php
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/1mn26ql
@r_php
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/1mn55g5
@r_php
Someone just made a YouTube tutorial for my Laravel-based ERP project!

Hi All,

Just discovered that someone created a video tutorial for Samarium, the Laravel based open sourcet ERP project I have been working on. Pretty surreal moment!

I have been posting about its updates here as well before. I was thinking of posting here when it is 0.9.7 but I just saw the video in youtube. Its the first time someone has made a youtube video of the project so i got kinda excited and thought of sharing here.

The video walks through the installation process and gives a nice overview of what the project is about. Always amazing to see when people in the community take time to create content around open source projects.

For those interested:

GitHub: [https://github.com/oitcode/samarium](https://github.com/oitcode/samarium)
YouTube tutorial: https://www.youtube.com/watch?v=fD4Wr8cT1CU

As the author, I know there are many bugs and lacking features in the project maybe, and also many part of the code needs refactor. But seeing a video someone else has made - that really gives added motivation.

Also, thanks to all the comment and feedback I had got here when i had posted before. I have implemented some of those, and it has been helpful.

Thanks and have a good time all.

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