PHP Reddit – Telegram
PHP Reddit
34 subscribers
291 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
Are there any PHP dependency containers which have support for package/module scoped services?

I know that there have been suggestions and RFCs for namespace scoped classes, package definitions, and other similar things within PHP, but I'm wondering if something like this has been implemented in userland through dependency injection.

The NestJS framework in JS implements module scoped services in a way that makes things fairly simple.

Each NestJS Module defines:

* **Providers**: Classes available for injection within the module's scope. These get registered in the module's service container and are private by default.
* **Exports**: Classes that other modules can access, but only if they explicitly import this module.
* **Imports**: Dependencies on other modules, giving access to their exported classes.

Modules can also be defined as global, which makes it available everywhere once imported by any module.

Here's what a simple app structure might look like:

```
AppModule
├─ OrmModule // Registers orm models
├─ UserModule
│ └─ OrmModule.forModels([User]) // Dynamic module
├─ AuthModule
│ ├─ UserModule
│ └─ JwtModule
└─ OrderModule
├─ OrmModule.forModels([Order, Product])
├─ UserModule
└─ AuthModule
```

This approach does a really good job at visualizing module dependencies while giving you module-scoped services. You can immediately see which modules depend on others, services are encapsulated by default preventing tight coupling, and the exports define exactly what each domain exposes to others.

Does anyone know of a PHP package that offers similar module scoped dependency injection? I've looked at standard PHP DI containers, but they don't provide this module level organization. Any suggestions would be appreciated!

https://redd.it/1l9tvoh
@r_php
Package Release Progressive JSON Streamer for PHP — inspired by Dan Abramov’s Progressive JSON → Laravel ready

Hey everyone,

I just released a small open-source package I built after watching Dan Abramov’s Progressive JSON video.
👉 youtube.com/watch/MaMQLNBZz64

The idea is to send a base JSON skeleton immediately, and stream placeholders progressively as your app resolves slower data (DB/API/etc).
→ Works great with React Suspense / Vue Suspense / dashboards / large APIs.

Laravel ready → works with response()->stream()
Vue / React friendly → tested with simple JS client
Supports nested placeholders → root.nested style
Breadth-first streaming (vs depth-first)

GitHub repo:
👉 https://github.com/egyjs/progressive-json-php

Would love to get your feedback — and especially curious if anyone sees other cool use cases inside Laravel apps.

Happy to answer any questions — cheers 🚀.

https://redd.it/1la3nmn
@r_php
I made a vichan backup noscript

https://github.com/Z4ph0d42/Vichan-Backup-noscript
I couldn't find a good solution to backing up my image board on vichan.
So I made my own.
It's a set it and forget it system and requires a second machine. I used a raspberry pi 4

https://redd.it/1lajily
@r_php
PHP Session Collision

We have some users that can log into the website as different users and if they just open multiple tabs to login in multiple times they get the same session ID for two totally different logins. That causes problems.

What is the method to avoid this?

https://redd.it/1laod4z
@r_php
I'm looking for a flat file review system where users can post reviews on the webpage

Free to affordable would be nice.

https://redd.it/1laoq59
@r_php
Export product data to PPT

Is there any paid services / APIs where data can be exported to PPT and other file formats and we can setup our own page layout.

https://redd.it/1lauo4d
@r_php
I’m Jess Archer, Engineering Team Lead of Laravel Nightwatch, Ask Me Anything

Hey r/laravel,

On Monday, June 16 (Tuesday for me here in Australia), we’re launching Laravel Nightwatch, a fully managed platform for monitoring Laravel application performance, error tracking, and logging.

I'll be hosting an AMA next Thursday, June 19 to answer your questions about Nightwatch. Add your questions below!

I’ll be answering questions here on Reddit and live on the Laravel YouTube Channel!

https://redd.it/1lb0whf
@r_php
[RFC] A shell noscript wrapper for docker compose commands

Introducing the `d` noscript. [Github repo](https://github.com/mortenscheel/d)

This noscript was inspired by Laravel's `sail` noscript, which makes it somewhat easier to run commands in the laravel.test container.

The readme contains all the necessary documentation and examples, but here's a sample.

# Regular docker compose subcommand pass-through
d up -d
d logs -f

# Automatic resolution of artisan commands containing a colon
d migrate:fresh --seed

# Running an artisan command with XDebug enabled
d debug some:command --foo

# Using custom aliases, which can be both global and project specific
d pending # php artisan migrate:status --pending
d dev # npm run dev

# Choosing to run in a fresh container (default runs with exec in existing container)
d @a test -p # A @ prefix means use `docker compose run --rm --no-deps`

# Using environment variables to modify defaults
D_SERVICE=db D_USER=mysql d mysql --user root

Aliases and environment variables can be defined globally (`~/.d`) and in the project (`./.d`).

D_SERVICE=php # Which compose service to target
D_USER=laravel # Which container user to
D_SHELL=bash # What to use for `d shell`

*:*=php artisan # Pattern matching commands with colons
a=php artisan # Regular alias
tinker=a tinker # Aliases can be used recursively
test=@a test -p # Run mode can be defined on the alias

I've been using an earlier version of this tool, which was written in Laravel Zero, for several years, and I can't live without it. But the PHP implementation (using Symfony Process) has some limitations regarding interactivity and TTY, so I decided to port it to a pure shell noscript.

I'd love to hear your comments and ideas for improvements.

https://redd.it/1lb7iao
@r_php
Are PHP Type Hints really required when using static code analysis tools like PHPStan?

In my current PHP8 project, I started in November, I use consequently type hinting.

Now I jumped to PHPStan at Level 8 and starts to fulfil the compliance requirements.
Nice tool btw.

Honestly, it is my first time to use phpstan, so this maybe be a blasphemy question.

Can some explain me when phpstan, etc. does a great work on checking code, keep variables consistencies and can be even enhanced to hard bleeding modes;

Why is it necessary to implement more and more performance killing runtime checks in a dynamic language?

I liked that type hints reduced the annotation orgies, but that cannot be the only reason?





https://redd.it/1lc0dqv
@r_php
Intelephense not indexing _ide_helper.php in Laravel project

Hey,
I'm having trouble getting Intelephense to index the `_ide_helper.php` file generated by `laravel-ide-helper`. I’ve tested this in both Emacs and Helix to rule out editor-specific issues — same result.

I’ve already:

* Increased `intelephense.files.maxSize` to 5MB,
* Verified it's located in the project root, and technically LSP must be able to index it
* Checked logs, but didn’t find anything useful.

Everything else in the project is indexed fine, it's just this helper file that seems to be ignored.

It can find the Auth facade from Illuminate/Foundation/Helpers, but not from the \_ide\_helper.php file.

Here's the example code where my LSP fails:

public function logout(): void
{
auth()->logout();
}

Any ideas on what might be going wrong, or what else I can check to get it fixed?

Appreciate any pointers!

https://redd.it/1lc2ol6
@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/1lc57m5
@r_php
Who is using livewire with php n laravel ?

Is there anyone using livewire heavily ?

https://redd.it/1lc93vg
@r_php
Sublime Text setup for Laravel ..... (PLEASE!!!)

Ok. I've given it many months with PHPStorm and other setups --- and I DO NOT like any of them at all. I really really tried. There are a lot of cool things in there... but - After spending the last few days with my classic ol Sublime Text --- please please please do not make me go back... I require so very little. Someone out there - must have a setup that covers the basics.

I'm open to other ideas too. If you've got a PHPStorm setup that is somehow 5x better than what I've got worked out - or want to delete everything in mine -- and show me the light / I'll return the favor.

As it stands -- I'd rather work in Sublime - and then go into every file one by one - afterward in PHPStorm and hit save for formatting and things like that.

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