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
Recommendations for Backend Hosting

I'm needing to provision a single mysql db, and to host some php code that will handle api calls from my front end - the API accepting 10-50 lines of text on an api transaction. Possibly 25 users simultaneously at any one time, but that may be a hopeful number even.

Between Railway and Linode (now called Akamai ), what might be the best option.
\- Looking for economy. The $5/mo plan on Railway, or the $12 plan on linode is what I'm looking at.
\- But, was wondering if anyone with experience in either hoster - if you found your useage all of a sudden is pushing the limits of the plan you choose, which hoster of the two makes it easy to just boost up to the next plan without having to re-deploy if that's possible.

Note: I was considering Linode because I heard they have built in protection against DDOS'ing, and have heard stories about big unexpected bills you can get.

https://redd.it/1l4hu0c
@r_php
Symfony Messenger in Node.js? Yes, it's possible!

The Symfony Messenger component is a powerful tool for building message-driven architectures, enabling seamless communication between services and transport layers. If you're a full-stack developer or work across multiple stacks, you might appreciate having similar patterns available in other ecosystems.

I wanted to share a library for NestJS that follows a similar philosophy to Symfony Messenger — and even draws inspiration from systems like NServiceBus in the .NET world. It brings structured, maintainable messaging to the Node.js ecosystem using decorators, handlers, middleware, and transport abstraction.

NPM package: https://www.npmjs.com/package/@nestjstools/messaging
Example repo: https://github.com/nestjstools/messaging-rabbitmq-example

If you're working in a polyglot setup or just curious about messaging in Node.js, give it a try and let me know what you think!

https://redd.it/1l4ufbe
@r_php
An easier way to document your Laravel endpoints using Swagger

Hi everyone!
Today I want to share a library I’ve been working on that makes documenting your Laravel API endpoints much easier.

During your E2E tests, this library captures the requests made to your endpoints and automatically generates the corresponding Swagger (OpenAPI) documentation.

For example, if you have a test like this:
function test_shouldCreateUser() {
$this
->perryHttp()
->withHeaders(['api_key' => 'some_api_key'])
->withBody([
'name' => 'John Doe',
'age' => 25,
'email' => 'john@doe.com',
'password' => 'password',
])
->post('/user')
->assertJson(['success' => true])
->assertStatus(Response::HTTP_CREATED);
}

The library will capture the request, response, headers, and other relevant details, then generate a Swagger-compatible YAML file documenting the endpoint automatically.

The generated file can be used with Swagger UI, Redoc, Postman, or any tool that supports OpenAPI specs.

## How to install

Install it via Composer:
composer require n4m-ward/laravel-perry


Then run the library using:
./vendor/bin/perry


You can check out the full documentation and source code on GitHub:
https://github.com/n4m-ward/perry

https://redd.it/1l5079q
@r_php
how to disable flush in test

Hi,

is it possible to disable flush only for the tests? so i can use the fixtures i have loaded and i can use zenstruck factory function to make a new entity, but when i test a post it persists the entity but just does not save it to the DB?

thank!

i use symfony 7.2 (doctrine and postgress)

and api platform 4.1

and phpunit for the tests

https://redd.it/1l53a4t
@r_php
Policy Attributes

Policies are a slightly obscure but critical part of Laravel security. They're the best solution to the common route-model-binding vulnerability where an attacker can just hit /post/123 even through they are only the author of /post/456. We've been working quietly on a proof concept to make CRUD resource controllers "locked by default" and to allow more explicating Model to Policy mapping using php attributes. https://github.com/icehouse-ventures/laravel-policy-attributes Taylor just merged a new Model-Policy mapping attribute called UsePolicy so it seemed a good time to get some feedback on upgrading the Controller side of things. Any feedback?

https://redd.it/1l5g1t1
@r_php
How do you set your rate limiters?

I had considered blocking ip addresses for more than 60 requests per minute for 24 hours and displaying a 429. But then I thought, no one sends 60+ requests per minute, 30 might be enough ... but then I thought, what about some search engine bots - maybe they need more requests.

It would probably also make sense to block ip addresses for example at more than 1000 requests per hour and 5000 requests per day (or so).

And, for example, try to reduce login attempts to 10 per hour.

Of course, it also depends on the application and the usual traffic.

So, how do you go about this? What does your setup look like and how do you find out if it is optimal?

https://redd.it/1l5th8q
@r_php
Modern full-featured non-blocking driver for AMQP 0.9.1

The driver is written entirely using fibers and offers the following features:
- automatic handling of delivery acknowledgments and returns in publisher confirms mode enabled;
- an alternative, more convenient API for transactions and message processing via a concurrent iterator;
- support for batch message processing;
- built-in RPC support.

For more features, refer to the library's documentation. Feedback is welcome.

https://github.com/thesis-php/amqp

https://redd.it/1l5zv4g
@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/1l6h1ps
@r_php
Startup Project

Hello, im building a startup. the stacks are symfony and expo for the mobile application. it is a SAAS product. I think it will be a successful idea and would like to ask if someone would like to collaborate with me to build it. To be completely honest i dont have money to pay, but i will provide shares from the profits once we go live. i will handle the marketing and sales. i should need a solid developer to help me build it. if you're serious, please DM with some of your work or CV.

Peace all! <3

https://redd.it/1l6g5lf
@r_php
PHP Records: In Userland

Some of you may remember my RFC on Records (https://wiki.php.net/rfc/records). After months of off-and-on R&D, I now present to you a general-use Records base-class: https://github.com/withinboredom/records

This library allows you to define and use records — albeit, with a bit of boilerplate. Records are value objects, meaning strict equality (===) is defined by value, not by reference. This is useful for unit types or custom scalar types (like "names", "users", or "ids").

Unfortunately, it is probably quite slow if you have a lot of records of a single type in memory (it uses an O(n) algorithm for interning due to being unable to access lower-level PHP internals). For most cases, it is probably still orders of magnitude faster than a database access. So, it should be fine.

https://redd.it/1l6p85a
@r_php
Just launched: Laravel AI Chat Starter Kit

I’ve just open-sourced a Laravel based AI chat starter kit built using:

* **Prism** (for AI/LLM integration)
* **Laravel Streams** (for native response streaming)
* **VILT stack** (Vue, Inertia, Laravel, Tailwind)

It comes with:

* Persistable chat history
* Model configuration
* Chat sharing
* Markdown & code rendering

[GitHub Repo](https://github.com/pushpak1300/ai-chat)

https://redd.it/1l6sdrz
@r_php
The most simple way to generate pdf for invoice n report

Hi guys,

I remember using phpjasperxml ver 0.9 in symfony 2.7 and php 5 to generate pdf.

What s current option to generate pdf for symfony 7 and php 8?

I read that phpjasper and phpjasperxml r possible. I also read gutenbergbundle. Which will be recommended for simplicity and ease of use? The invoice and the report r simple pdf without any fancy stuff.

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