PHP Reddit – Telegram
PHP Reddit
34 subscribers
293 photos
37 videos
24.9K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Is Laravel Broadcasting suitable for real-time online game?

I struggle to understand how multiplayer online games work with WebSockets. I've always thought that they keep one connection open for both sides of the communication - sending and receiving, so the latency is as minimal as possible.

However, Laravel seems to suggest sending messages via WebSockets through axios or fetch API, which is where I'm confused. Isn't creating new HTTP requests considered slow? There is a lot going on to dispatch a request, bootstrap the app etc. Doesn't it kill all the purpose of WebSocket connection, which is supposed to be almost real-time?

Is PHP a suboptimal choice for real-time multiplayer games in general? Do some other languages or technologies keep the app open in memory, so HTTP requests are not necessary? It's really confusing to me, because I haven't seen any tutorials using Broadcasting without axios or fetch.

How do I implement a game that, for example, stores my action in a database and sends it immediately to other players?

https://redd.it/1j64tak
@r_php
DAE get frustrated when searching for a Composer package for "foo" and only find "laravel-foo"?

I get that many people use Laravel, but like myself, many don't. I'd much rather use independent packages that are not wired in to illuminate or whatever. Why not make an independent package for the functionality, and then add a bridge/wrapper for Laravel? That way you can support many frameworks if you so choose.

https://redd.it/1j67jov
@r_php
Whats your approach for realtime applications on shared hosts

When it comes to realtime web applications, its always things like ReactPHP, or nodejs based websocket, or similar tools that are not really an option on shared hosts.
The next obvious thing would be SSE, but because of the usual low php process limit, this isnt an option as well if youre not the only person using the application...

So I'm curious what do others use? Is a 3rd party tool like pusher the only option?

https://redd.it/1j6eqae
@r_php
LarAgent v0.2.0 Released

Hello, Laravel devs! Just released a new version with updates:

* Support for Laravel 12
* Dynamic model setting
* New command for batch cleaning of chat histories `php artisan agent:chat:clear AgentName`

Check the release notes here:

[https://github.com/MaestroError/LarAgent/releases/tag/0.2.0](https://github.com/MaestroError/LarAgent/releases/tag/0.2.0)



https://redd.it/1j6jbmc
@r_php
🚀 Laravel 12 – The Future of Laravel? Controversy, Starter Kits & Laravel Cloud!
https://youtu.be/yDNqi2EZ2Uo

https://redd.it/1j6mxvd
@r_php
Regexp class in SPL

Anyone else ever lament that PHP doesn't have a Regexp class in its std lib (e.g. Ruby, JS) to represent a regular expression and associated flags?

Instead, we always have to deal with patterns as strings, which can be annoying:

It would be especially helpful in configuration, where there can often be something like MyConfig::$match: string that can be handled as an exact match or regex pattern. With them both as strings, we often have to resort to additional configuration, e.g. MyConfig::$exactMatch: bool. And even with that, it doesn't provide anywhere to configure regex flags.

Woudln't it be great if there were a SPL Regexp object, so we could just have MyConfig::$pattern: string|\Regexp?

Curiously, `RegexIterator` exists, but not something simpler for a single expression.

https://redd.it/1j6n2wc
@r_php
Laravel Package Directory

Ever found a useful package and wished more people knew about it? Now you can submit it to Indxs.dev, where developers explore and discover great tools.

Right now, we have three indexes:
PHP
Laravel
Filament

If you know a package that deserves a spot, go ahead and add it. Let's make it easier for devs to find the right tools!
https://indxs.dev


https://redd.it/1j77dqn
@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/1j7c1k4
@r_php
[Update] Laravel AI Translator: Now with Extended Thinking, Crowdin Support, and Beautiful Terminal UI

Hey Laravel folks! Remember that AI translation package I shared a while back? Well, I've been busy cooking up some major improvements, and I'm excited to share what's new.

# The Big One: Context makes your website feel like local website

The biggest game-changer in this update is how we handle translation context. Now, when translating any string, the AI sees EVERYTHING - all previously translated strings and all source strings across ALL your files. This means your translations stay incredibly consistent. No more "Login" being translated five different ways across your app.

Example terminal output showing the context loading:

Loading reference: ko_KR - 9 files
Using context: 10 files, 71 items

# Gorgeous Terminal UI

The terminal output got a serious glow-up. It's not just pretty - it's informative as hell. You get:

* Real-time progress for each translation
* Token usage tracking (yes, you can see exactly how much each translation costs)
* Color-coded status indicators
* Detailed file processing information

Here's a snippet of what it looks like now:

File Translation
File: profile.php
Language: ko_KR
Source: lang/en/profile.php
Target: lang/ko_KR/profile.php

Processing chunk 1/2 (50 strings)
Using context: 10 files, 71 items
🧠 AI Thinking...
⟳ profile.matches.columns.deaths → 죽음
⟳ profile.matches.columns.knocked → 넉다운
Tokens: Input=2193, Output=3, Total=2196

[Example of extended thinking](https://preview.redd.it/xvzbrtt8mpne1.png?width=2034&format=png&auto=webp&s=879517ffeb75137450df78aa04849ce3ec6e1cb3)



https://preview.redd.it/qho3zfjhmpne1.png?width=2572&format=png&auto=webp&s=fcaeaeddfe76afd93622777ca83b00fd52282bc5

# Claude 3.7 Sonnet with Extended Thinking

We're now leveraging Claude 3.7's Extended Thinking capabilities. This means:

* Massive 200K token context window
* Up to 64K output tokens
* Better reasoning for complex translations
* More natural and contextually aware translations

# Surprise Feature: Crowdin Integration (Beta)

Here's something cool - you can now translate your Crowdin projects directly! And it's not just for Laravel - it works with ANY project on Crowdin. Want to know how? Drop a comment, and I'll share the details.

# Complete Code Overhaul

I basically rewrote the entire thing. The codebase is now:

* More maintainable with dedicated service classes
* Better organized with clear separation of concerns
* More efficient with optimized API calls
* More robust with improved error handling

# Want to Try It Out?

Check out the package: [kargnas/laravel-ai-translator](https://github.com/kargnas/laravel-ai-translator)

Let me know if you have any questions or run into issues. I'm actively maintaining this and would love your feedback!

P.S. If you're using the previous version, you might want to update - the consistency improvements alone are worth it.

P.S. Look at the default config file!

https://redd.it/1j7efct
@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/1j7pbfw
@r_php
Samarium v0.9.4 - Improvements and fixes (PHP code update, DB seeding update, misc)

Hello all,

Made some improvements and fixes during February and March upto now to the ERP I have been developing with Laravel and Livewire. Wanted to share version 0.9.4 with you all. Also, thanks to couple of pull requests from the community.

https://github.com/oitcode/samarium

|Area|Improvements|
|:-|:-|
|PHP code updates|Updated PHP code to more recent standard with return type hinting in methods in Controller and Livewire components.|
|Test Code|Added some more test code. (Thanks to PR).|
|Database seeding|Added more seeder files. Now a minimum working website is setup as soon as you run seeder files at the beginning of installation.|
|Misc updates|Refactored many blade files to make them more easier to understand.|


Dashboard

https://preview.redd.it/j7b0byo11tne1.png?width=1850&format=png&auto=webp&s=9cca52e88ffb6c9005afc26cf1f997924a638870

Website homepage

https://preview.redd.it/ppi3kww41tne1.png?width=1848&format=png&auto=webp&s=d5fc9250be5b2dbb343f4c6aa06a14d5f76f2731

Just wanted to share this update here after working during February and March upto now.

Any feedback, comments and/or contributions are highly appreciated.

Thanks.

https://redd.it/1j7s9k1
@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/1j7stwo
@r_php
Laravel updated its home page again, for the better.

Kudos to the team for listening to the community's feedback regarding the latest design changes. 👍

Posting this because I was among those who criticized the "scroll jacking" and bezels on the code blocks.

https://preview.redd.it/rrdwk9qvmtne1.jpg?width=1080&format=pjpg&auto=webp&s=af5a895f40f48f700e707f628f3db74be3ceae03



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