Laravel MultiTenant, MultiDatabase (JOBS)
Bom, estou desenvolvendo um cardápio online totalmente em Laravel. A aplicação já estava praticamente pronta, mas tive a ideia de transformá-la em multi-tenant. Grande parte já está funcionando, porém me deparei com um problema.
Tenho um banco principal, que vou chamar de "Principal", e os bancos dos tenants: "Tenant1", "Tenant2", e assim por diante. Estou utilizando filas do Laravel porque também uso WebSocket (Laravel Reverb), além da integração com WhatsApp via Twilio.
Centralizei todos os jobs na tabela do banco Principal, ou seja, todos os jobs de todos os tenants são enfileirados lá. Como a aplicação é um cardápio, ela não precisa ser 100% em tempo real, então esse modelo faz sentido.
O problema é que, quando envio um job para disparar mensagens no WhatsApp, a aplicação não consegue se conectar ao banco do tenant. Esse job chama um service responsável pelo envio.
Alguém aqui já trabalhou com filas em sistema multi-tenant no Laravel e poderia me dar uma luz?
https://redd.it/1njp5nf
@r_php
Bom, estou desenvolvendo um cardápio online totalmente em Laravel. A aplicação já estava praticamente pronta, mas tive a ideia de transformá-la em multi-tenant. Grande parte já está funcionando, porém me deparei com um problema.
Tenho um banco principal, que vou chamar de "Principal", e os bancos dos tenants: "Tenant1", "Tenant2", e assim por diante. Estou utilizando filas do Laravel porque também uso WebSocket (Laravel Reverb), além da integração com WhatsApp via Twilio.
Centralizei todos os jobs na tabela do banco Principal, ou seja, todos os jobs de todos os tenants são enfileirados lá. Como a aplicação é um cardápio, ela não precisa ser 100% em tempo real, então esse modelo faz sentido.
O problema é que, quando envio um job para disparar mensagens no WhatsApp, a aplicação não consegue se conectar ao banco do tenant. Esse job chama um service responsável pelo envio.
Alguém aqui já trabalhou com filas em sistema multi-tenant no Laravel e poderia me dar uma luz?
https://redd.it/1njp5nf
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Laravel 12.29: Disable all global scopes except chosen ones
https://nabilhassen.com/laravel-1229-disable-all-global-scopes-except-chosen
https://redd.it/1nk1mze
@r_php
https://nabilhassen.com/laravel-1229-disable-all-global-scopes-except-chosen
https://redd.it/1nk1mze
@r_php
Nabilhassen
Laravel 12.29: Disable all global scopes except chosen
Laravel 12.29 adds withoutGlobalScopesExcept() to Eloquent, letting you disable all global scopes except the ones you want to keep.
Any plans for proper PHP gRPC server support in 2025?
My organisation is looking at gRPC for internal service communications in place of our existing REST/GraphQL calls. But what’s holding us back from moving towards this direction is we have several PHP mature services that we actively maintain.
Given we have the PHP foundation established, gRPC is a feature I feel that is missing in today’s modern PHP toolkit that isn’t discussed about often, especially with it gaining popularity over the years. There’s full support running gRPC servers in other languages but not PHP.
Is this something that is on the radars of the PHP foundation? Or is the only way is to adopt 3rd party/community developed solutions which seems more like a workaround?
I’m talking about 3rd party plugins like https://github.com/khepin/php-grpc-server-notes which needs to run on RoadRunner, which aren’t actively maintained.
https://redd.it/1nk3paj
@r_php
My organisation is looking at gRPC for internal service communications in place of our existing REST/GraphQL calls. But what’s holding us back from moving towards this direction is we have several PHP mature services that we actively maintain.
Given we have the PHP foundation established, gRPC is a feature I feel that is missing in today’s modern PHP toolkit that isn’t discussed about often, especially with it gaining popularity over the years. There’s full support running gRPC servers in other languages but not PHP.
Is this something that is on the radars of the PHP foundation? Or is the only way is to adopt 3rd party/community developed solutions which seems more like a workaround?
I’m talking about 3rd party plugins like https://github.com/khepin/php-grpc-server-notes which needs to run on RoadRunner, which aren’t actively maintained.
https://redd.it/1nk3paj
@r_php
GitHub
GitHub - khepin/php-grpc-server-notes
Contribute to khepin/php-grpc-server-notes development by creating an account on GitHub.
PDFAI - A simple library for extracting data from PDFs for large language models
Hi /r/PHP,
I just published a new, simple, low dependency PHP library for extracting text and rasterizing PDF pages using the Poppler command line tools.
You can find out about it here:
https://github.com/1tomany/pdf-ai
It's perfect if you're building any type of RAG system, or just need a way to rasterize PDF pages to display as thumbnails. The extractors take advantage of generators so extracting multiple pages should be performant and light on memory.
I also released a Symfony bundle that uses a pattern I'm calling Action-Request-Response (I'm sure it has an actual name - please let me know if so). Instead of accessing the client directly, you create a request that is sent to a client which processes the request and sends back a response. This makes testing much easier because you can swap out the actual client implementation with a mock implementation without changing any of your business logic.
You can see it in action here:
https://github.com/1tomany/pdf-ai-bundle
This pattern can be used with the standalone library, you'll just be responsible for creating a container of extractors, injecting them into the factory, and using the factory to create the extractor.
Would love your feedback!
https://redd.it/1nk54tj
@r_php
Hi /r/PHP,
I just published a new, simple, low dependency PHP library for extracting text and rasterizing PDF pages using the Poppler command line tools.
You can find out about it here:
https://github.com/1tomany/pdf-ai
It's perfect if you're building any type of RAG system, or just need a way to rasterize PDF pages to display as thumbnails. The extractors take advantage of generators so extracting multiple pages should be performant and light on memory.
I also released a Symfony bundle that uses a pattern I'm calling Action-Request-Response (I'm sure it has an actual name - please let me know if so). Instead of accessing the client directly, you create a request that is sent to a client which processes the request and sends back a response. This makes testing much easier because you can swap out the actual client implementation with a mock implementation without changing any of your business logic.
You can see it in action here:
https://github.com/1tomany/pdf-ai-bundle
This pattern can be used with the standalone library, you'll just be responsible for creating a container of extractors, injecting them into the factory, and using the factory to create the extractor.
Would love your feedback!
https://redd.it/1nk54tj
@r_php
GitHub
GitHub - 1tomany/pdf-ai: A simple PHP library that makes extracting data from PDFs for large language models easy
A simple PHP library that makes extracting data from PDFs for large language models easy - 1tomany/pdf-ai
We wanted to upgrade our Laravel 5.8 project to the latest version but first we needed strongly typed data classes with support for validating properties using Laravel's validation rules, as well as creating nested structures so I wrote this class and published in case it might be useful to someone.
This is meant to be used before you upgrade Laravel to a high enough version. After you do, you can start using `spatie/laravel-data` and remove this.
https://github.com/gigabites19/old-laravel-typed
https://redd.it/1nk9729
@r_php
This is meant to be used before you upgrade Laravel to a high enough version. After you do, you can start using `spatie/laravel-data` and remove this.
https://github.com/gigabites19/old-laravel-typed
https://redd.it/1nk9729
@r_php
GitHub
GitHub - gigabites19/old-laravel-typed: Something akin to `spatie/laravel-data` for old laravel versions
Something akin to `spatie/laravel-data` for old laravel versions - gigabites19/old-laravel-typed
PHP Fundamentals [Full Course]
https://youtu.be/EX3qQqdm16I?feature=shared
https://redd.it/1nkaxhr
@r_php
https://youtu.be/EX3qQqdm16I?feature=shared
https://redd.it/1nkaxhr
@r_php
YouTube
PHP Fundamentals [FULL COURSE]
Learn the essentials of modern PHP in this beginner-friendly course. Whether you're new to PHP or coming from another language, this course provides a solid foundation for PHP development and prepares you for working with Laravel. In 10 concise lessons, we'll…
GitHub - dunglas/frankenphp-grpc: A PHP extension to write gRPC servers using the official gRPC library written in Go
https://github.com/dunglas/frankenphp-grpc
https://redd.it/1nkbzlm
@r_php
https://github.com/dunglas/frankenphp-grpc
https://redd.it/1nkbzlm
@r_php
GitHub
GitHub - dunglas/frankenphp-grpc: A PHP extension to write gRPC servers using the official gRPC library written in Go
A PHP extension to write gRPC servers using the official gRPC library written in Go - GitHub - dunglas/frankenphp-grpc: A PHP extension to write gRPC servers using the official gRPC library writt...
Looking for TWIG PHP developer
I'm looking for TWIG PHP developer to help fix existing website issues between frontend and and admin backend if anyone could or take the gig
https://redd.it/1nkh6yv
@r_php
I'm looking for TWIG PHP developer to help fix existing website issues between frontend and and admin backend if anyone could or take the gig
https://redd.it/1nkh6yv
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
Getting Started with Laravel (Updated Laravel Bootcamp Full Course)
https://youtu.be/MOLZOXqaomM
https://redd.it/1nkhulp
@r_php
https://youtu.be/MOLZOXqaomM
https://redd.it/1nkhulp
@r_php
YouTube
Learn Laravel from Scratch [FULL BOOTCAMP COURSE]
Welcome to the official Getting Started with Laravel course. In this bootcamp, we will learn how to build your first full-stack application with Laravel from start to finish, from `laravel new` to a deployed product.
We will build a social media application…
We will build a social media application…
dumpall: A Simple CLI to Aggregate Laravel Files for Reviews & AI Workflows 🐱💻
Hey r/laravel! 👋 As a Laravel dev, I've wasted hours manually grabbing files from modules or migrations for reviews or AI prompts—tabs everywhere, context lost! 😩 So, I built **dumpall**, a lightweight CLI that dumps your Laravel project files into clean Markdown (fenced blocks with paths). It's Unix-simple, like cat for directories, and great for Artisan-heavy setups.
**5 Laravel use cases that save my sanity:**
* 🛠️ **Module Sharing**: Dump a full module (e.g., Modules/User/) for team/AI reviews—no folder-hopping.
* 🤖 **Feature Planning**: Aggregate Models & routes, paste to AI for new endpoints like past ones.
* 🐛 **Migration Debug**: database/migrations/ in one go—spot schema issues fast.
* 📦 **Config Archiving**: Combine config/ & Artisan files for audits/handovers.
* 🔍 **Model Refactoring**: Pull Models/ + Traits/ for AI-optimized suggestions.
Try it in your Laravel project:
npx dumpall . -e vendor -e node_modules --clip
It's open-source: 🌐 [dumpall.pages.dev](https://dumpall.pages.dev/) | 📦 [github.com/ThisIsntMyId/dumpall](https://github.com/ThisIsntMyId/dumpall). Feedback welcome—what Laravel workflow would you use this for? Let's iterate! 🚀
https://redd.it/1nkufx6
@r_php
Hey r/laravel! 👋 As a Laravel dev, I've wasted hours manually grabbing files from modules or migrations for reviews or AI prompts—tabs everywhere, context lost! 😩 So, I built **dumpall**, a lightweight CLI that dumps your Laravel project files into clean Markdown (fenced blocks with paths). It's Unix-simple, like cat for directories, and great for Artisan-heavy setups.
**5 Laravel use cases that save my sanity:**
* 🛠️ **Module Sharing**: Dump a full module (e.g., Modules/User/) for team/AI reviews—no folder-hopping.
* 🤖 **Feature Planning**: Aggregate Models & routes, paste to AI for new endpoints like past ones.
* 🐛 **Migration Debug**: database/migrations/ in one go—spot schema issues fast.
* 📦 **Config Archiving**: Combine config/ & Artisan files for audits/handovers.
* 🔍 **Model Refactoring**: Pull Models/ + Traits/ for AI-optimized suggestions.
Try it in your Laravel project:
npx dumpall . -e vendor -e node_modules --clip
It's open-source: 🌐 [dumpall.pages.dev](https://dumpall.pages.dev/) | 📦 [github.com/ThisIsntMyId/dumpall](https://github.com/ThisIsntMyId/dumpall). Feedback welcome—what Laravel workflow would you use this for? Let's iterate! 🚀
https://redd.it/1nkufx6
@r_php
dumpall.pages.dev
dumpall - The Smart File Aggregator for AI Context
A CLI utility to display the contents of files in a directory, formatted in Markdown for AI context.
Who's hiring/looking
This is a bi-monthly thread aimed to connect PHP companies and developers who are hiring or looking for a job.
Rules
No recruiters
Don't share any personal info like email addresses or phone numbers in this thread. Contact each other via DM to get in touch
If you're hiring: don't just link to an external website, take the time to describe what you're looking for in the thread.
If you're looking: feel free to share your portfolio, GitHub, … as well. Keep into account the personal information rule, so don't just share your CV and be done with it.
https://redd.it/1nkxkon
@r_php
This is a bi-monthly thread aimed to connect PHP companies and developers who are hiring or looking for a job.
Rules
No recruiters
Don't share any personal info like email addresses or phone numbers in this thread. Contact each other via DM to get in touch
If you're hiring: don't just link to an external website, take the time to describe what you're looking for in the thread.
If you're looking: feel free to share your portfolio, GitHub, … as well. Keep into account the personal information rule, so don't just share your CV and be done with it.
https://redd.it/1nkxkon
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Hi
I posted here before about my problem as an intery level and I depend a lot on ai to code:) also I guess I lack the basics so, help me by giving me like a good roadmap/course/book that helped you through the php/laravel stack…
So that I stop vibe coding cause I really hate that and I am really trying
https://redd.it/1nky2xo
@r_php
I posted here before about my problem as an intery level and I depend a lot on ai to code:) also I guess I lack the basics so, help me by giving me like a good roadmap/course/book that helped you through the php/laravel stack…
So that I stop vibe coding cause I really hate that and I am really trying
https://redd.it/1nky2xo
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Introducing StreamPulse: Reliable Event Streaming for Laravel Applications
Hey Laravel community! I'm excited to share **StreamPulse**, a package I've been working on to solve distributed event streaming in the Laravel ecosystem.
# What is StreamPulse?
StreamPulse provides a clean, Laravel-native way to publish and consume events between distributed applications. Built on Redis Streams, it handles all the complexity of reliable messaging while giving you a simple API that feels right at home in Laravel.
# Key Features
* **Laravel-native experience** with an API that feels familiar
* **Transaction-aware publishing** \- events tied to your database transactions
* **Resilient processing** with automatic retries and dead letter queues
* **Monitoring dashboard** to visualize and manage your streams
* **Redis Streams integration** with plans for additional drivers
# Why I Built This
Working with distributed systems in Laravel, I found myself repeatedly implementing custom solutions for reliable cross-application messaging. StreamPulse abstracts all that complexity away, letting you focus on your business logic.
# Beta Release - Feedback Welcome!
This is a beta release, and I'd love your feedback! Try it out, open issues, suggest features, or contribute code.
**Check it out:** [**github.com/saravanasai/stream-pulse**](vscode-file://vscode-app/c:/Users/sarav/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html)
If you find this useful, please consider giving it a star!
https://redd.it/1nlbmj2
@r_php
Hey Laravel community! I'm excited to share **StreamPulse**, a package I've been working on to solve distributed event streaming in the Laravel ecosystem.
# What is StreamPulse?
StreamPulse provides a clean, Laravel-native way to publish and consume events between distributed applications. Built on Redis Streams, it handles all the complexity of reliable messaging while giving you a simple API that feels right at home in Laravel.
# Key Features
* **Laravel-native experience** with an API that feels familiar
* **Transaction-aware publishing** \- events tied to your database transactions
* **Resilient processing** with automatic retries and dead letter queues
* **Monitoring dashboard** to visualize and manage your streams
* **Redis Streams integration** with plans for additional drivers
# Why I Built This
Working with distributed systems in Laravel, I found myself repeatedly implementing custom solutions for reliable cross-application messaging. StreamPulse abstracts all that complexity away, letting you focus on your business logic.
# Beta Release - Feedback Welcome!
This is a beta release, and I'd love your feedback! Try it out, open issues, suggest features, or contribute code.
**Check it out:** [**github.com/saravanasai/stream-pulse**](vscode-file://vscode-app/c:/Users/sarav/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html)
If you find this useful, please consider giving it a star!
https://redd.it/1nlbmj2
@r_php
A bundle to handle images
Hello,
I'm looking for a bundle to handle images upload and preview in the form. Actually i do things manually but i want a package that will reduce my work. Any idea please ? I'm on Symfony 7.3 actually.
https://redd.it/1nlh7ks
@r_php
Hello,
I'm looking for a bundle to handle images upload and preview in the form. Actually i do things manually but i want a package that will reduce my work. Any idea please ? I'm on Symfony 7.3 actually.
https://redd.it/1nlh7ks
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
This sub should have a rule not to promote Laravel packages.
Almost every day, I see developers here promoting their Laravel packages. They forget that this is a framework-specific extension.
This sub is for questions, news and comments on general PHP subjects. Framework-agnostic packages are also welcome to be promoted here. But damn, not everyone uses Laravel. There's also Symfony and about 7128 other frameworks. Use the appropriate sub for that. Thanks.
https://redd.it/1nli767
@r_php
Almost every day, I see developers here promoting their Laravel packages. They forget that this is a framework-specific extension.
This sub is for questions, news and comments on general PHP subjects. Framework-agnostic packages are also welcome to be promoted here. But damn, not everyone uses Laravel. There's also Symfony and about 7128 other frameworks. Use the appropriate sub for that. Thanks.
https://redd.it/1nli767
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Unknown column type "array" requested with VichUploaderBundle
I just installed https://github.com/dustin10/VichUploaderBundle in my app. I have a Product entity that will have many images, so i created a ProductImage entity for an image.
But when i run
Any idea about it please ?
https://redd.it/1nlmqx0
@r_php
I just installed https://github.com/dustin10/VichUploaderBundle in my app. I have a Product entity that will have many images, so i created a ProductImage entity for an image.
...
#[ORM\Entity]
#[Vich\Uploadable]
class ProductImage implements TimestampableInterface
{
use TimestampableTrait;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Vich\UploadableField(mapping: 'product_images', fileNameProperty: 'imageName', size: 'imageSize')]
private ?File $imageFile = null;
#[ORM\Column(nullable: true)]
private ?string $imageName = null;
#[ORM\Column(nullable: true)]
private ?int $imageSize = null;
#[ORM\Column]
private bool $isMain = false;
#[ORM\ManyToOne(inversedBy: 'images')]
#[ORM\JoinColumn(nullable: false)]
private ?Product $product = null;
...
But when i run
symfony console make:migration i have an error:In UnknownColumnType.php line 15:
Unknown column type "array" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You c
an get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then
you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have yo
ur custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some m
apping information.
Any idea about it please ?
https://redd.it/1nlmqx0
@r_php
GitHub
GitHub - dustin10/VichUploaderBundle: A simple Symfony bundle to ease file uploads with ORM entities and ODM documents.
A simple Symfony bundle to ease file uploads with ORM entities and ODM documents. - dustin10/VichUploaderBundle
Using the new session cache in Laravel
https://amitmerchant.com/using-session-cache-laravel/
https://redd.it/1nlqnb0
@r_php
https://amitmerchant.com/using-session-cache-laravel/
https://redd.it/1nlqnb0
@r_php
Amit Merchant
Using the new session cache in Laravel
Laravel’s cache system is a powerful tool that allows developers to store and retrieve data quickly, improving the performance of their applications. Usually, caching is done using various drivers like Redis, Memcached, Database or even the file system.
How do you feel about PHP in phones?
Just to be clear, I know many of you will know who I am and what I'm representing here. So I'm not going to link to or name anything specifically; I'm here with a genuine question because I want to understand this community's sentiment towards this general topic, not a specific implementation.
I don't want this to be about the name of a package or the fact that it only supports this framework or that framework. Please try to extrapolate from where we are right now and think forwards.
Is running PHP in more places good or bad? Why?
What pitfalls do you think most PHP developers will fall into as they try to apply their skills to platforms other than the web?
Here's my take to get things going:
I've been a PHP developer for 25 years. I love using PHP. I think the language and tooling around it is fantastic, and in recent years has evolved and matured immensely and continues to do so.
I've invested a lot of my career into PHP and I want to see it continue. I also want to be able to expand the things I can do with these skills. I love building for the web, but it is not the only place where I work & play, nor my clients, nor their customers.
I'm a pragmatic software engineer at heart; I want to create meaningful solutions to interesting problems. PHP allows me to do that rapidly, safely, and with little fanfare, so I can move on to solving the next set of problems (probably ones I've created).
So having PHP work anywhere feels like a massive win to me and I welcome its continued expansion, and I will personally continue to push for it to happen.
If we can embrace this opportunity and help fellow PHP devs to level up to working rapidly and safely on these new platforms, the future of PHP could be even brighter.
Thanks in advance for a thoughtful and considered discussion 🙏🏼
https://redd.it/1nlxq2v
@r_php
Just to be clear, I know many of you will know who I am and what I'm representing here. So I'm not going to link to or name anything specifically; I'm here with a genuine question because I want to understand this community's sentiment towards this general topic, not a specific implementation.
I don't want this to be about the name of a package or the fact that it only supports this framework or that framework. Please try to extrapolate from where we are right now and think forwards.
Is running PHP in more places good or bad? Why?
What pitfalls do you think most PHP developers will fall into as they try to apply their skills to platforms other than the web?
Here's my take to get things going:
I've been a PHP developer for 25 years. I love using PHP. I think the language and tooling around it is fantastic, and in recent years has evolved and matured immensely and continues to do so.
I've invested a lot of my career into PHP and I want to see it continue. I also want to be able to expand the things I can do with these skills. I love building for the web, but it is not the only place where I work & play, nor my clients, nor their customers.
I'm a pragmatic software engineer at heart; I want to create meaningful solutions to interesting problems. PHP allows me to do that rapidly, safely, and with little fanfare, so I can move on to solving the next set of problems (probably ones I've created).
So having PHP work anywhere feels like a massive win to me and I welcome its continued expansion, and I will personally continue to push for it to happen.
If we can embrace this opportunity and help fellow PHP devs to level up to working rapidly and safely on these new platforms, the future of PHP could be even brighter.
Thanks in advance for a thoughtful and considered discussion 🙏🏼
https://redd.it/1nlxq2v
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
PHPStan Opinionated Nomenclature
https://github.com/samlitowitz/phpstan-opinionated-nomenclature
https://redd.it/1nlx12j
@r_php
https://github.com/samlitowitz/phpstan-opinionated-nomenclature
https://redd.it/1nlx12j
@r_php
GitHub
GitHub - samlitowitz/phpstan-opinionated-nomenclature: Opinionated PHPStan rules for naming things
Opinionated PHPStan rules for naming things. Contribute to samlitowitz/phpstan-opinionated-nomenclature development by creating an account on GitHub.