Thoughts on "Laravel as Backend for Frontend"
Hi everyone,
I currently have two APIs built with Laravel, and a centralized authentication system also using Laravel along Passport, Spatie Permission & Socialite.
I'm in the process of migrating my app from Remix v2 to React Router v7. Although everything is going smoothly, some things are bugging me - I am talking about things that in PHP and especially Laravel are easy to solve. For example trying to now set a second cookie on a RR redirect, but nada (https://github.com/remix-run/remix/issues/231). Also an unstable middleware, server and client loaders and actions. It becomes a mess and you are trying to find a workaround for too many things. Your BFF becomes harder than your actual back-end.
Mutations: For multiple on page or component actions, either I have to use TanstackQuery mutations (which I have to handle and do validator.revalidate() so RR will know that it has to re-fetch the data) or I have to name my actions(with an intent or some property) and make a handler in the main action to match the name and the callback. If I want to use the RR7 useFetcher hook for example, I have to make a second abstraction hook on top of the first one(useFetcher, useSubmit) to add callbacks like onSuccess, onError and so on.
So, I was thinking that Laravel along with Inertia can act like a nice BFF. Only fetching data from my APIs, caching, managing the session, refreshing tokens, and more. What are your thoughts on this? Anyone that has already tried it?
P.S I would not add Inertia and views to any of my APIs. I like to separate these two concerns.
https://redd.it/1jdfpng
@r_php
Hi everyone,
I currently have two APIs built with Laravel, and a centralized authentication system also using Laravel along Passport, Spatie Permission & Socialite.
I'm in the process of migrating my app from Remix v2 to React Router v7. Although everything is going smoothly, some things are bugging me - I am talking about things that in PHP and especially Laravel are easy to solve. For example trying to now set a second cookie on a RR redirect, but nada (https://github.com/remix-run/remix/issues/231). Also an unstable middleware, server and client loaders and actions. It becomes a mess and you are trying to find a workaround for too many things. Your BFF becomes harder than your actual back-end.
Mutations: For multiple on page or component actions, either I have to use TanstackQuery mutations (which I have to handle and do validator.revalidate() so RR will know that it has to re-fetch the data) or I have to name my actions(with an intent or some property) and make a handler in the main action to match the name and the callback. If I want to use the RR7 useFetcher hook for example, I have to make a second abstraction hook on top of the first one(useFetcher, useSubmit) to add callbacks like onSuccess, onError and so on.
So, I was thinking that Laravel along with Inertia can act like a nice BFF. Only fetching data from my APIs, caching, managing the session, refreshing tokens, and more. What are your thoughts on this? Anyone that has already tried it?
P.S I would not add Inertia and views to any of my APIs. I like to separate these two concerns.
https://redd.it/1jdfpng
@r_php
GitHub
How to set multiple `Set-Cookie` headers in a single response? · Issue #231 · remix-run/remix
I tried copying concatSetCookieHeaders from remix but that... eh, doesn't work... Doing that I end up with a single set-cookie header. Here's the relevant code: const sessionIdCookie = awai...
"elePHPant" toy!
I'm having a hard time getting hold of an elePHPant soft toy in the UK.
So apparently this is the official website: https://www.elephpant.com/, but I can't actually buy one from there! Seems like only the origami version is available haha!
I also came across this site: https://www.phpclasses.org/shop/product/eles1/ but that's way too expensive! It's comes to £50 with delivery.
Anyone know where I can get one from that isn't going to cost the earth?
EDIT: I also found this site: https://elephpant.co.uk/, which looks promising. They say they are going to launch later this year, well let's see about that! I've signed up anyhow.
https://redd.it/1jdma7g
@r_php
I'm having a hard time getting hold of an elePHPant soft toy in the UK.
So apparently this is the official website: https://www.elephpant.com/, but I can't actually buy one from there! Seems like only the origami version is available haha!
I also came across this site: https://www.phpclasses.org/shop/product/eles1/ but that's way too expensive! It's comes to £50 with delivery.
Anyone know where I can get one from that isn't going to cost the earth?
EDIT: I also found this site: https://elephpant.co.uk/, which looks promising. They say they are going to launch later this year, well let's see about that! I've signed up anyhow.
https://redd.it/1jdma7g
@r_php
Elephpant
SLOTZEUS88 – Link Resmi Kakek Zeus Slot88 Gacor Bonus New Member 2026
SLOTZEUS88 merupakan link resmi Kakek Zeus Slot88 gacor dengan bonus khusus new member 2026, koleksi game populer, sistem aman, dan peluang kemenangan maksimal setiap hari.
How do you manage file uploads?
After several months away from my PC, I've started coding again. I'm currently working on a Symfony project (version 7.2) with an administration tool using the EasyAdmin bundle. Until now, I've been managing image uploads with VichUploaderBundle. Not being satisfied with the basic rendering of the Vich field, I want to transform it into a dropzone with a preview, but I'm a little lost, and I have several questions: Is Vich still relevant for managing file uploads to a Symfony project? Which library do you recommend for creating the dropzone? I've tried Filepond, but I can't get the files to be saved correctly. Would it be simpler to simply "dress up" the basic Vich field to make it more aesthetically pleasing/functional?
https://redd.it/1jdnmbv
@r_php
After several months away from my PC, I've started coding again. I'm currently working on a Symfony project (version 7.2) with an administration tool using the EasyAdmin bundle. Until now, I've been managing image uploads with VichUploaderBundle. Not being satisfied with the basic rendering of the Vich field, I want to transform it into a dropzone with a preview, but I'm a little lost, and I have several questions: Is Vich still relevant for managing file uploads to a Symfony project? Which library do you recommend for creating the dropzone? I've tried Filepond, but I can't get the files to be saved correctly. Would it be simpler to simply "dress up" the basic Vich field to make it more aesthetically pleasing/functional?
https://redd.it/1jdnmbv
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
Getting Started with Value Objects in Symfony
https://ngandu.hashnode.dev/getting-started-with-value-objects-in-symfony
https://redd.it/1jdo1yb
@r_php
https://ngandu.hashnode.dev/getting-started-with-value-objects-in-symfony
https://redd.it/1jdo1yb
@r_php
Anyone moved a a laravel app from digital ocean to hetzner?
I've been using digital ocean for years so i'm a little tentative to leave but looking at hetzner's offering it seems I could either save loads of money or massively upgrade my resources for the same amount. Has anyone made the switch and it was worth it?
I have a traditional server side rendered forum (blade etc) that generally has 150k unique visitors per day occasionally peaks upto 500k unique visitors per day.
Currently I have:
£336- Server - CPU-Optimized / 32 GB / 16 vCPUs
$240 - MySQL - Basic 16 GB / 6 vCPU / 290 GB Disk
$300 - 15TB Spaces usage
Total: $860
With Hetzner:
$107 - Server - 64 GB/ 16 vCPUs
$54 - Server (MySQL) - 32GB / 8 vCPUs / 240 GB Disk
$90 - 15TB Object Storage
Total: $251
A crazy 70% discount!
Or I could totally beef up my resources for the same amount
$320 - Server - 192 GB/ 48 vCPUs
$215 - Master MySQL - 128GB / 32 vCPUs / 600 GB Disk
$215 - Read Only MySQL - 128GB / 32 vCPUs / 600 GB Disk
$90 - 15TB Object Storage
Total: $840
Basically the same price with alot more piece of mind and hopefully performance improvements for the end user as well.
Maybe I wouldn't even need the second servers for MySQL and could just go back to having MySQL running on the one server given the huge resources available.
But i'm obviously concerned how long it would take (1 months work $$$ vs $600 a month saving) and the potential downtime. Everything could be copied slowly in the background and it would just be the database that needs to be dumped and imported possibly over an hour or two (50GB database). Which doesn't sound so bad, but then again, disaster could occur.
Has anyone made the transition and have some stories to tell of how you went about it, how long you took etc?
Maybe one month is far more than i'd need and it would only take a day or two to get setup. But ideally i'd like to do a few weeks load testing to make sure all the configs are set up properly.
https://redd.it/1jdpd6n
@r_php
I've been using digital ocean for years so i'm a little tentative to leave but looking at hetzner's offering it seems I could either save loads of money or massively upgrade my resources for the same amount. Has anyone made the switch and it was worth it?
I have a traditional server side rendered forum (blade etc) that generally has 150k unique visitors per day occasionally peaks upto 500k unique visitors per day.
Currently I have:
£336- Server - CPU-Optimized / 32 GB / 16 vCPUs
$240 - MySQL - Basic 16 GB / 6 vCPU / 290 GB Disk
$300 - 15TB Spaces usage
Total: $860
With Hetzner:
$107 - Server - 64 GB/ 16 vCPUs
$54 - Server (MySQL) - 32GB / 8 vCPUs / 240 GB Disk
$90 - 15TB Object Storage
Total: $251
A crazy 70% discount!
Or I could totally beef up my resources for the same amount
$320 - Server - 192 GB/ 48 vCPUs
$215 - Master MySQL - 128GB / 32 vCPUs / 600 GB Disk
$215 - Read Only MySQL - 128GB / 32 vCPUs / 600 GB Disk
$90 - 15TB Object Storage
Total: $840
Basically the same price with alot more piece of mind and hopefully performance improvements for the end user as well.
Maybe I wouldn't even need the second servers for MySQL and could just go back to having MySQL running on the one server given the huge resources available.
But i'm obviously concerned how long it would take (1 months work $$$ vs $600 a month saving) and the potential downtime. Everything could be copied slowly in the background and it would just be the database that needs to be dumped and imported possibly over an hour or two (50GB database). Which doesn't sound so bad, but then again, disaster could occur.
Has anyone made the transition and have some stories to tell of how you went about it, how long you took etc?
Maybe one month is far more than i'd need and it would only take a day or two to get setup. But ideally i'd like to do a few weeks load testing to make sure all the configs are set up properly.
https://redd.it/1jdpd6n
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
How would be a MMORPG game using PHP and Symfony?
https://postimg.cc/62bsLQtz
https://redd.it/1jdtj3v
@r_php
https://postimg.cc/62bsLQtz
https://redd.it/1jdtj3v
@r_php
postimg.cc
Schermata del 2025 03 14 21 46 45 — Postimages
Form submit on drop down selection change without button
Is it possible to achieve this in symfony form?
Let say i want to load data based on drop down list selection. When user change selection, the data is loaded from database without user having to press load button.
It s basically asking the form to submit on selection change instead pressing button.
https://redd.it/1jdwg8l
@r_php
Is it possible to achieve this in symfony form?
Let say i want to load data based on drop down list selection. When user change selection, the data is loaded from database without user having to press load button.
It s basically asking the form to submit on selection change instead pressing button.
https://redd.it/1jdwg8l
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
How I make my Inertia applications as type safe as possible
Hi everyone!
There have been a couple of posts regarding type safety using Laravel & Inertia. I've also been playing around with this over the past year or so and landed on a solution that works very well for me, so I thought I'd share it. The GIF below shows me changing a parameter in PHP and immediately receiving errors in both PHP & TypeScript.
[My approach to type safety in Inertia detects errors immediately](https://i.redd.it/gvgut8p51epe1.gif)
The steps to achieve this are as follows:
* **Set Up Dependencies**: Install [Laravel Data](https://github.com/spatie/laravel-data/) and [TypeScript Transformer](https://github.com/spatie/laravel-typenoscript-transformer), publish the config for the latter
* **Use Data Objects**: Use data objects as second parameter to `inertia` or `Inertia::render` functions
* **(Optional) Enable Deferred Props**: Ensure `DeferProp` is typed correctly by extending the `default_type_replacements` key of the transformer’s config
* **Generate Types From Data Objects**: Use a composer noscript to generate TypeScript types from your data objects
* **Use Types in React / Vue**: Use the generated types in the App.Data namespace in your React / Vue components
* **Automate Type Updates**: Extend `vite.config.js` with custom plugin to regenerate types whenever data classes change
* **(Optional) CI/CD**: Run type generation in CI so the build fails in case of type errors
If you want to look at the step by step tutorial, you can check out my latest blog post [https://matthiasweiss.at/blog/bulletproofing-inertia-how-i-maximize-type-safety-in-laravel-monoliths/](https://matthiasweiss.at/blog/bulletproofing-inertia-how-i-maximize-type-safety-in-laravel-monoliths/)
Best,
Matthias
https://redd.it/1jdycoc
@r_php
Hi everyone!
There have been a couple of posts regarding type safety using Laravel & Inertia. I've also been playing around with this over the past year or so and landed on a solution that works very well for me, so I thought I'd share it. The GIF below shows me changing a parameter in PHP and immediately receiving errors in both PHP & TypeScript.
[My approach to type safety in Inertia detects errors immediately](https://i.redd.it/gvgut8p51epe1.gif)
The steps to achieve this are as follows:
* **Set Up Dependencies**: Install [Laravel Data](https://github.com/spatie/laravel-data/) and [TypeScript Transformer](https://github.com/spatie/laravel-typenoscript-transformer), publish the config for the latter
* **Use Data Objects**: Use data objects as second parameter to `inertia` or `Inertia::render` functions
* **(Optional) Enable Deferred Props**: Ensure `DeferProp` is typed correctly by extending the `default_type_replacements` key of the transformer’s config
* **Generate Types From Data Objects**: Use a composer noscript to generate TypeScript types from your data objects
* **Use Types in React / Vue**: Use the generated types in the App.Data namespace in your React / Vue components
* **Automate Type Updates**: Extend `vite.config.js` with custom plugin to regenerate types whenever data classes change
* **(Optional) CI/CD**: Run type generation in CI so the build fails in case of type errors
If you want to look at the step by step tutorial, you can check out my latest blog post [https://matthiasweiss.at/blog/bulletproofing-inertia-how-i-maximize-type-safety-in-laravel-monoliths/](https://matthiasweiss.at/blog/bulletproofing-inertia-how-i-maximize-type-safety-in-laravel-monoliths/)
Best,
Matthias
https://redd.it/1jdycoc
@r_php
Deploying Laravel
In a world that has so many different technologies, what's the best for Laravel deployment? Do I use docker or something similar? Do I just keep running apache?
My current stack is a ec2 aws instance running Amazon Linux, and my Laravel app uses almost all from the framework (queues, broadcasting, background jobs...) and version 10.
Marked this as a discussion because my stack is working perfectly, but I'm afraid that it will become hard to maintain in a couple of years. So I want to hear your ideas and how you deploy your own apps.
Edit: I thought that more people used containers
https://redd.it/1je2rmi
@r_php
In a world that has so many different technologies, what's the best for Laravel deployment? Do I use docker or something similar? Do I just keep running apache?
My current stack is a ec2 aws instance running Amazon Linux, and my Laravel app uses almost all from the framework (queues, broadcasting, background jobs...) and version 10.
Marked this as a discussion because my stack is working perfectly, but I'm afraid that it will become hard to maintain in a couple of years. So I want to hear your ideas and how you deploy your own apps.
Edit: I thought that more people used containers
https://redd.it/1je2rmi
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
Config vs. Enum for Managing Supported File Conversions – What’s Your Preference?
Hey r/Laravel community! 👋
A few weeks ago, I launched **Doxswap** (pre-release), a Laravel package for **seamless document conversion** (DOCX → PDF, Markdown → HTML, etc.). The response was **really positive**, and I got **valuable feedback**—especially from this subreddit! 🙌
Now, as I work toward **Doxswap v1**, I’m tackling a design decision:
# 🔍 The Problem
I need a way to **store and validate**:
* **Which conversions are supported** (e.g., DOCX → PDF is valid, but PNG → DOCX is not).
* **MIME types for each format** (e.g., `application/pdf` for PDFs).
* **Easy maintenance & future expansion** (new formats, integrations, etc.).
Right now, I’m debating between **storing this data in a config file (**`config/doxswap.php`**)** or using an **Enum class (**`DocumentFormat::class`**)**. I’d love to hear your thoughts! 🚀
Currently in the pre-release it's all stored in config. But I plan on adding more conversion drivers which could make the doxswap config bloated as I would have to specify support conversions and mime types for each conversion driver.
Option 1: stick with config
'drivers' => [
'libreoffice' => [
'path' => env('LIBRE_OFFICE_PATH', '/usr/bin/soffice'),
'supported_conversions' => [
'doc' => ['pdf', 'docx', 'odt', 'rtf', 'txt', 'html', 'epub', 'xml'],
'docx' => ['pdf', 'odt', 'rtf', 'txt', 'html', 'epub', 'xml'],
'odt' => ['pdf', 'docx', 'doc', 'txt', 'rtf', 'html', 'xml'],
'rtf' => ['pdf', 'docx', 'odt', 'txt', 'html', 'xml'],
'txt' => ['pdf', 'docx', 'odt', 'html', 'xml'],
'html' => ['pdf', 'odt', 'txt'],
'xml' => ['pdf', 'docx', 'odt', 'txt', 'html'],
'csv' => ['pdf', 'xlsx', 'ods', 'html'],
'xlsx' => ['pdf', 'ods', 'csv', 'html'],
'ods' => ['pdf', 'xlsx', 'xls', 'csv', 'html'],
'xls' => ['pdf', 'ods', 'csv', 'html'],
'pptx' => ['pdf', 'odp'],
'ppt' => ['pdf', 'odp'],
'odp' => ['pdf', 'pptx', 'ppt'],
'noscript' => ['pdf', 'png', 'jpg', 'tiff'],
'jpg' => ['pdf', 'png', 'noscript'],
'png' => ['pdf', 'jpg', 'noscript'],
'bmp' => ['pdf', 'jpg', 'png'],
'tiff' => ['pdf', 'jpg', 'png'],
],
'mime_types' => [
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'odt' => 'application/vnd.oasis.opendocument.text',
'rtf' => 'text/rtf',
'txt' => 'text/plain',
'html' => 'text/html',
'xml' => 'text/xml',
'csv' => 'text/csv',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xls' => 'application/vnd.ms-excel',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'ppt' => 'application/vnd.ms-powerpoint',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'noscript' => 'image/noscript+xml',
'jpg' => 'image/jpeg',
'png' => 'image/png',
'bmp' => 'image/bmp',
'tiff' => 'image/tiff',
]
],
# ✅ Pros:
✔️ **Easier to modify** – No code changes needed; just edit `config/doxswap.php`.
✔️ **Supports environment overrides** – Can be adjusted dynamically via `.env` or `config()` calls.
✔️ **User-friendly for package consumers** – Developers using my package can **customize it without modifying
Hey r/Laravel community! 👋
A few weeks ago, I launched **Doxswap** (pre-release), a Laravel package for **seamless document conversion** (DOCX → PDF, Markdown → HTML, etc.). The response was **really positive**, and I got **valuable feedback**—especially from this subreddit! 🙌
Now, as I work toward **Doxswap v1**, I’m tackling a design decision:
# 🔍 The Problem
I need a way to **store and validate**:
* **Which conversions are supported** (e.g., DOCX → PDF is valid, but PNG → DOCX is not).
* **MIME types for each format** (e.g., `application/pdf` for PDFs).
* **Easy maintenance & future expansion** (new formats, integrations, etc.).
Right now, I’m debating between **storing this data in a config file (**`config/doxswap.php`**)** or using an **Enum class (**`DocumentFormat::class`**)**. I’d love to hear your thoughts! 🚀
Currently in the pre-release it's all stored in config. But I plan on adding more conversion drivers which could make the doxswap config bloated as I would have to specify support conversions and mime types for each conversion driver.
Option 1: stick with config
'drivers' => [
'libreoffice' => [
'path' => env('LIBRE_OFFICE_PATH', '/usr/bin/soffice'),
'supported_conversions' => [
'doc' => ['pdf', 'docx', 'odt', 'rtf', 'txt', 'html', 'epub', 'xml'],
'docx' => ['pdf', 'odt', 'rtf', 'txt', 'html', 'epub', 'xml'],
'odt' => ['pdf', 'docx', 'doc', 'txt', 'rtf', 'html', 'xml'],
'rtf' => ['pdf', 'docx', 'odt', 'txt', 'html', 'xml'],
'txt' => ['pdf', 'docx', 'odt', 'html', 'xml'],
'html' => ['pdf', 'odt', 'txt'],
'xml' => ['pdf', 'docx', 'odt', 'txt', 'html'],
'csv' => ['pdf', 'xlsx', 'ods', 'html'],
'xlsx' => ['pdf', 'ods', 'csv', 'html'],
'ods' => ['pdf', 'xlsx', 'xls', 'csv', 'html'],
'xls' => ['pdf', 'ods', 'csv', 'html'],
'pptx' => ['pdf', 'odp'],
'ppt' => ['pdf', 'odp'],
'odp' => ['pdf', 'pptx', 'ppt'],
'noscript' => ['pdf', 'png', 'jpg', 'tiff'],
'jpg' => ['pdf', 'png', 'noscript'],
'png' => ['pdf', 'jpg', 'noscript'],
'bmp' => ['pdf', 'jpg', 'png'],
'tiff' => ['pdf', 'jpg', 'png'],
],
'mime_types' => [
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'odt' => 'application/vnd.oasis.opendocument.text',
'rtf' => 'text/rtf',
'txt' => 'text/plain',
'html' => 'text/html',
'xml' => 'text/xml',
'csv' => 'text/csv',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xls' => 'application/vnd.ms-excel',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'ppt' => 'application/vnd.ms-powerpoint',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'noscript' => 'image/noscript+xml',
'jpg' => 'image/jpeg',
'png' => 'image/png',
'bmp' => 'image/bmp',
'tiff' => 'image/tiff',
]
],
# ✅ Pros:
✔️ **Easier to modify** – No code changes needed; just edit `config/doxswap.php`.
✔️ **Supports environment overrides** – Can be adjusted dynamically via `.env` or `config()` calls.
✔️ **User-friendly for package consumers** – Developers using my package can **customize it without modifying
source code**.
# ❌ Cons:
❌ **No strict typing** – You could accidentally pass an unsupported format.
❌ **No IDE auto-completion** – Developers don’t get hints for available formats.
❌ **Can be less performant** – Uses `config()` calls vs. in-memory constants.
Option 2: Using an Enum (`DocumentFormat.php`)
namespace App\Enums;
enum LibreOfficeDocumentFormat: string
{
case DOC = 'doc';
case DOCX = 'docx';
case PDF = 'pdf';
case XLSX = 'xlsx';
case CSV = 'csv';
public static function values(): array
{
return array_column(self::cases(), 'value');
}
public static function isValid(string $format): bool
{
return in_array($format, self::values(), true);
}
}
# ✅ Pros:
✔️ **Strict typing** – Prevents typos and ensures only valid formats are used.
✔️ **IDE auto-completion** – Developers get **hints** when selecting formats.
✔️ **Better performance** – Faster than config files since values are stored in memory.
# ❌ Cons:
❌ **Harder to modify dynamically** – Requires **code changes** to add/remove formats.
❌ **Less user-friendly for package consumers** – They must **extend the Enum** instead of just changing a config file.
❌ **Less flexible for future expansion** – Adding support for new formats requires **code changes** rather than a simple config update.
# 🗳️ What Do You Prefer?
Which approach do you think is **better for a Laravel package**?
Would you prefer a **config file for flexibility** or **an Enum for strict validation**?
The other question is "would anyone even need to modify the config or mime types?"
🚀 Looking forward to hearing your thoughts as I work toward **Doxswap v1!** 🔥
You can check out Doxswap here [https://github.com/Blaspsoft/doxswap](https://github.com/Blaspsoft/doxswap)
https://redd.it/1je2r7v
@r_php
# ❌ Cons:
❌ **No strict typing** – You could accidentally pass an unsupported format.
❌ **No IDE auto-completion** – Developers don’t get hints for available formats.
❌ **Can be less performant** – Uses `config()` calls vs. in-memory constants.
Option 2: Using an Enum (`DocumentFormat.php`)
namespace App\Enums;
enum LibreOfficeDocumentFormat: string
{
case DOC = 'doc';
case DOCX = 'docx';
case PDF = 'pdf';
case XLSX = 'xlsx';
case CSV = 'csv';
public static function values(): array
{
return array_column(self::cases(), 'value');
}
public static function isValid(string $format): bool
{
return in_array($format, self::values(), true);
}
}
# ✅ Pros:
✔️ **Strict typing** – Prevents typos and ensures only valid formats are used.
✔️ **IDE auto-completion** – Developers get **hints** when selecting formats.
✔️ **Better performance** – Faster than config files since values are stored in memory.
# ❌ Cons:
❌ **Harder to modify dynamically** – Requires **code changes** to add/remove formats.
❌ **Less user-friendly for package consumers** – They must **extend the Enum** instead of just changing a config file.
❌ **Less flexible for future expansion** – Adding support for new formats requires **code changes** rather than a simple config update.
# 🗳️ What Do You Prefer?
Which approach do you think is **better for a Laravel package**?
Would you prefer a **config file for flexibility** or **an Enum for strict validation**?
The other question is "would anyone even need to modify the config or mime types?"
🚀 Looking forward to hearing your thoughts as I work toward **Doxswap v1!** 🔥
You can check out Doxswap here [https://github.com/Blaspsoft/doxswap](https://github.com/Blaspsoft/doxswap)
https://redd.it/1je2r7v
@r_php
GitHub
GitHub - Blaspsoft/doxswap: 📄 🔄 Doxswap is a Laravel package for seamless document conversion using LibreOffice. Effortlessly convert…
📄 🔄 Doxswap is a Laravel package for seamless document conversion using LibreOffice. Effortlessly convert DOCX, PDF, ODT, and more with a simple, elegant API. Supports Laravel storage, configurable...
Enums for authorisation
https://laravel-news.com/authorization-backed-enums
I do think being able to use an enum in authorisation checks is an improvement over directly using strings but I’m not sure backed enum are much better.
I’ve not checked, but I suspect that the enum is converted to its backed value rather than using its identity to find the correct check. It feels like a missed opportunity.
https://redd.it/1je4s29
@r_php
https://laravel-news.com/authorization-backed-enums
I do think being able to use an enum in authorisation checks is an improvement over directly using strings but I’m not sure backed enum are much better.
I’ve not checked, but I suspect that the enum is converted to its backed value rather than using its identity to find the correct check. It feels like a missed opportunity.
https://redd.it/1je4s29
@r_php
Laravel News
Enhancing Laravel Authorization with Backed Enums - Laravel News
Enhance your Laravel application's security model with backed enum support for permissions. This feature provides a type-safe approach to authorization checks while improving code readability and maintainability.
Laravel Starter Kit, or Laravel SPA
For SaaS, what's better to use, the laravel starter kit for either Vue or React, or use Laravel with Vue for example as SPA application? I haven't used any of the starter kits, I've only used Laravel wit Vue SPA, what are the advantages of using the starter kit?
I have no experience with Interia
Sorry for the confusion: I meant a SPA with Laravel Sanctum, Pinia and etc, versus the default SPA that are the starter kits
https://redd.it/1je9618
@r_php
For SaaS, what's better to use, the laravel starter kit for either Vue or React, or use Laravel with Vue for example as SPA application? I haven't used any of the starter kits, I've only used Laravel wit Vue SPA, what are the advantages of using the starter kit?
I have no experience with Interia
Sorry for the confusion: I meant a SPA with Laravel Sanctum, Pinia and etc, versus the default SPA that are the starter kits
https://redd.it/1je9618
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
How Much Memory Does A Worker Use?
Yep, I get the logical fallacy here. May as well ask how long is a rope. BUT...I'm wondering from your experience what have you seen as an average in your projects? I'd like to do some basic calculations to estimate how much ram my VPS will need for an upcoming project. Not looking for anything exact, just roughly.
If you would like, you can assume my project will be extensive and lots of features and tools. Complex.
https://redd.it/1jeag1a
@r_php
Yep, I get the logical fallacy here. May as well ask how long is a rope. BUT...I'm wondering from your experience what have you seen as an average in your projects? I'd like to do some basic calculations to estimate how much ram my VPS will need for an upcoming project. Not looking for anything exact, just roughly.
If you would like, you can assume my project will be extensive and lots of features and tools. Complex.
https://redd.it/1jeag1a
@r_php
Should I learn PHP or .NET?
I already know web development with react and next js and I wanted to learn something related backend to upscale myself I don’t want to learn node although I know how it works (don’t know how to code in it) I’m confused between PHP and .NET.
https://redd.it/1jem95k
@r_php
I already know web development with react and next js and I wanted to learn something related backend to upscale myself I don’t want to learn node although I know how it works (don’t know how to code in it) I’m confused between PHP and .NET.
https://redd.it/1jem95k
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Form still submit through live component instead of symfony controller
Where am I doing it wrongly?
I have the live component extends abstract controller with defaultactiontrait and compnentwithformtrait as per documentation and create form via instantiateForm.
Inside symfony controller I have created form as usual and then pass the form to live component via twig as per documentation.
When it rendered first time, the form created in symfony controller is used. But when I submit, it appears live component form is submitted instead.
My impression is there is seperate form instance being created when a refresh is done in live component.
I saw in symfony profile, there r two POST, first one was for symfony controller and second POST was for live component.
https://redd.it/1jeozl1
@r_php
Where am I doing it wrongly?
I have the live component extends abstract controller with defaultactiontrait and compnentwithformtrait as per documentation and create form via instantiateForm.
Inside symfony controller I have created form as usual and then pass the form to live component via twig as per documentation.
When it rendered first time, the form created in symfony controller is used. But when I submit, it appears live component form is submitted instead.
My impression is there is seperate form instance being created when a refresh is done in live component.
I saw in symfony profile, there r two POST, first one was for symfony controller and second POST was for live component.
https://redd.it/1jeozl1
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
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/1jesouk
@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/1jesouk
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
ddBody, Context Methods & One of Many in Laravel 12.2
https://youtu.be/nozCdZ_AFIs
https://redd.it/1jewjxm
@r_php
https://youtu.be/nozCdZ_AFIs
https://redd.it/1jewjxm
@r_php
YouTube
ddBody, Context Methods & One of Many in Laravel 12.2
What's new in Laravel is back! We share new features of the Laravel framework every week 🙌 (v12.2)
1️⃣ Collection Chunk Without Preserving Keys
https://github.com/laravel/framework/pull/54916
2️⃣ ddBody
https://github.com/laravel/framework/pull/54933…
1️⃣ Collection Chunk Without Preserving Keys
https://github.com/laravel/framework/pull/54916
2️⃣ ddBody
https://github.com/laravel/framework/pull/54933…
Can't Livewire be smart enough to detect Alpinejs is already installed on the project and not install(run) it again?
I've spent 3 hours trying to solve an issue with a volt component today. I had an input with a variable binded with wire:model attribute. And I just couldn't get the variable to change. Every other thing was working on the app though, it successfully created a DB record, but just didn't empty the text input no matter what I did.
Some of the things I tried :
Then I remembered I started this project with Breeze auth (which comes with alpinejs), and then I installed livewire/volt which apparently also runs alpinejs in the background.
I'm 100% aware that this particular case was a skill issue, since simply opening the Dev tools console showed what was causing the error;
But the thing is, I was writing PHP code the whole way. And you don't debug with Dev tools console when you're writing PHP. That's why I wasted 3 hours looking everywhere for a bug except the console.
So, back to my question: is it not possible to add some conditions to check if alpinejs already initialized in the
https://redd.it/1jf3dbc
@r_php
I've spent 3 hours trying to solve an issue with a volt component today. I had an input with a variable binded with wire:model attribute. And I just couldn't get the variable to change. Every other thing was working on the app though, it successfully created a DB record, but just didn't empty the text input no matter what I did.
Some of the things I tried :
$a = $this->pull('string'), $this->reset('string'), and even straight up $this->string = "";Then I remembered I started this project with Breeze auth (which comes with alpinejs), and then I installed livewire/volt which apparently also runs alpinejs in the background.
I'm 100% aware that this particular case was a skill issue, since simply opening the Dev tools console showed what was causing the error;
Detected multiple instances of Alpine runningBut the thing is, I was writing PHP code the whole way. And you don't debug with Dev tools console when you're writing PHP. That's why I wasted 3 hours looking everywhere for a bug except the console.
So, back to my question: is it not possible to add some conditions to check if alpinejs already initialized in the
app.js file, so that both of these first (and almost-first) party Laravel packages wouldn't conflict with each other when installed on a brand new project?https://redd.it/1jf3dbc
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community