I built a package to stop hardcoding Stripe price IDs everywhere
I've been working with Stripe quite a bit recently and was wondering if there could be something better than having Stripe price and product IDs hard-coded in env files, trying to match resources between sandboxes and production, and having our checkout crash if we forgot to add some values somewhere.
I've built this little package and it's been quite useful on some freelancing gigs, and I wanted to release it here to gather some feedback, in order to make it as useful as possible.
The idea is to define your products and prices in a config file, deploy them to Stripe with a single command, and then access them with type-safe keys, like so:
// config/billing.php
'products' => [
'pro' => [
'name' => 'Pro Plan',
'prices' => [
'monthly' => [
'amount' => 2999,
'currency' => 'usd',
'recurring' => ['interval' => 'month'],
],
],
],
],
This creates/updates everything in Stripe, caches it locally in your DB, and auto-generates enums for your IDE, and provides you with a facade to access all your resources easily.
// Before
`$user->checkout('price_1ABC123xyz789');`
// After
`$user->checkout(BillingRepository::priceId(ProductKey::Pro, PriceKey::Monthly));`
What it gives you:
* Version control for billing - Your pricing structure lives in git, not just in the Stripe dashboard
* No API calls at runtime - IDs are cached in your DB
* Auto-generated enums - IDE autocomplete, catch typos at dev time
* Two-way sync - Deploy config → Stripe, or import existing Stripe setup → config
* Handles Stripe's immutable fields - When you change a price amount, it detects this and lets you archive the old price or create a duplicate
**Importing existing setup:**
If you already have products in Stripe, you can pull them into a config file:
`php artisan billing:import --generate-config`
It's essentially infrastructure-as-code for your billing setup.
I've released it as 0.9.0 as I haven't implemented it yet in a large production codebase, so use at your own risk.
\---
GitHub: [https://github.com/valentin-morice/laravel-billing-repository](https://github.com/valentin-morice/laravel-billing-repository)
Packagist: [https://packagist.org/packages/valentin-morice/laravel-billing-repository](https://packagist.org/packages/valentin-morice/laravel-billing-repository)
\---
https://redd.it/1qklho3
@r_php
I've been working with Stripe quite a bit recently and was wondering if there could be something better than having Stripe price and product IDs hard-coded in env files, trying to match resources between sandboxes and production, and having our checkout crash if we forgot to add some values somewhere.
I've built this little package and it's been quite useful on some freelancing gigs, and I wanted to release it here to gather some feedback, in order to make it as useful as possible.
The idea is to define your products and prices in a config file, deploy them to Stripe with a single command, and then access them with type-safe keys, like so:
// config/billing.php
'products' => [
'pro' => [
'name' => 'Pro Plan',
'prices' => [
'monthly' => [
'amount' => 2999,
'currency' => 'usd',
'recurring' => ['interval' => 'month'],
],
],
],
],
This creates/updates everything in Stripe, caches it locally in your DB, and auto-generates enums for your IDE, and provides you with a facade to access all your resources easily.
// Before
`$user->checkout('price_1ABC123xyz789');`
// After
`$user->checkout(BillingRepository::priceId(ProductKey::Pro, PriceKey::Monthly));`
What it gives you:
* Version control for billing - Your pricing structure lives in git, not just in the Stripe dashboard
* No API calls at runtime - IDs are cached in your DB
* Auto-generated enums - IDE autocomplete, catch typos at dev time
* Two-way sync - Deploy config → Stripe, or import existing Stripe setup → config
* Handles Stripe's immutable fields - When you change a price amount, it detects this and lets you archive the old price or create a duplicate
**Importing existing setup:**
If you already have products in Stripe, you can pull them into a config file:
`php artisan billing:import --generate-config`
It's essentially infrastructure-as-code for your billing setup.
I've released it as 0.9.0 as I haven't implemented it yet in a large production codebase, so use at your own risk.
\---
GitHub: [https://github.com/valentin-morice/laravel-billing-repository](https://github.com/valentin-morice/laravel-billing-repository)
Packagist: [https://packagist.org/packages/valentin-morice/laravel-billing-repository](https://packagist.org/packages/valentin-morice/laravel-billing-repository)
\---
https://redd.it/1qklho3
@r_php
GitHub
GitHub - valentin-morice/laravel-billing-repository: Config-as-code for billing providers in Laravel.
Config-as-code for billing providers in Laravel. Contribute to valentin-morice/laravel-billing-repository development by creating an account on GitHub.
Life Timeline: Real-time multiplayer app built with Swoole + Mezzio
Demo: [https://timeline.zweiundeins.gmbh](https://timeline.zweiundeins.gmbh)
Github: [https://github.com/mbolli/php-timeline](https://github.com/mbolli/php-timeline)
I just put my Life Timeline app in production. It's a horizontal timeline app (think Google Sheets timeline view meets Adobe Premiere's track layout) with real-time multiplayer.
I was interested in Swoole's performance but found most examples are either single-file noscripts or custom frameworks. I wanted to see if you could build a "proper" PHP application (PSR-15 middleware, dependency injection, structured architecture) while still benefiting from Swoole's persistent workers. Spoiler: you can, and Mezzio makes it pretty seamless.
**The real-time architecture:** The multiplayer sync uses a pattern I really like:
* **CQRS (Command Query Responsibility Segregation):** Write operations go through Command Handlers, reads through Query Handlers. Each command handler does its thing (update database) and then emits an event.
* **Event Bus:** When a command completes, it fires a `TimelineChangedEvent` to a Swoole-based event bus. This is just a simple pub/sub: The bus holds subscriber callbacks in memory (works because Swoole workers are persistent).
* **SSE (Server-Sent Events):** When clients connect to `/updates`, they subscribe to the event bus. The connection stays open (Swoole coroutines handle this efficiently). When any client makes a change, the event fires, all subscribers get notified, and we push a re-rendered HTML fragment to each client using [Datastar](https://data-star.dev/)'s `PatchElements` format.
The nice thing is there's no WebSocket complexity, no separate pub/sub server (Redis, etc.) — it's all in-process because Swoole workers persist. Obviously this only works for single-server deployments, but for many apps that's fine (or just replace the event bus with NATS).
Feedback welcome. Have you already used this pattern?
https://redd.it/1qklpup
@r_php
Demo: [https://timeline.zweiundeins.gmbh](https://timeline.zweiundeins.gmbh)
Github: [https://github.com/mbolli/php-timeline](https://github.com/mbolli/php-timeline)
I just put my Life Timeline app in production. It's a horizontal timeline app (think Google Sheets timeline view meets Adobe Premiere's track layout) with real-time multiplayer.
I was interested in Swoole's performance but found most examples are either single-file noscripts or custom frameworks. I wanted to see if you could build a "proper" PHP application (PSR-15 middleware, dependency injection, structured architecture) while still benefiting from Swoole's persistent workers. Spoiler: you can, and Mezzio makes it pretty seamless.
**The real-time architecture:** The multiplayer sync uses a pattern I really like:
* **CQRS (Command Query Responsibility Segregation):** Write operations go through Command Handlers, reads through Query Handlers. Each command handler does its thing (update database) and then emits an event.
* **Event Bus:** When a command completes, it fires a `TimelineChangedEvent` to a Swoole-based event bus. This is just a simple pub/sub: The bus holds subscriber callbacks in memory (works because Swoole workers are persistent).
* **SSE (Server-Sent Events):** When clients connect to `/updates`, they subscribe to the event bus. The connection stays open (Swoole coroutines handle this efficiently). When any client makes a change, the event fires, all subscribers get notified, and we push a re-rendered HTML fragment to each client using [Datastar](https://data-star.dev/)'s `PatchElements` format.
The nice thing is there's no WebSocket complexity, no separate pub/sub server (Redis, etc.) — it's all in-process because Swoole workers persist. Obviously this only works for single-server deployments, but for many apps that's fine (or just replace the event bus with NATS).
Feedback welcome. Have you already used this pattern?
https://redd.it/1qklpup
@r_php
GitHub
GitHub - mbolli/php-timeline: High-performance PHP timeline app built with Swoole, Mezzio & Datastar. Real-time multiplayer via…
High-performance PHP timeline app built with Swoole, Mezzio & Datastar. Real-time multiplayer via SSE, CQRS architecture, PSR-7/PSR-15 middleware. A reference implementation for building mo...
A new simple library for reading EXIF data
I'm building an application that allows users to upload photos to it. I needed access to the EXIF data if available, so I assumed I could just use
Not so simple. I assumed EXIF data was just basic ASCII text, but I assumed wrong. Some values are byte arrays or enums that are encoded with NUL bytes and attempting to serialized them as JSON to be stored in at UTF-8 column failed.
Additionally, I didn't realize that coordinates weren't stored as floating point latitude, longitude pairs that we're familiar with. The EXIF standard doesn't support floating point numbers, so they're encoded as a list of strings that represent the degrees, minutes, and seconds as a fraction (and cardinal direction as a string).
Packagist showed a few existing EXIF libraries, but they looked like overkill for what I needed. So, like every PHP developer, I wrote yet another package named
It's dependency free (aside from the
Check it out, I'd love to hear your feedback: https://github.com/1tomany/exif-tools
https://redd.it/1qkxgc8
@r_php
I'm building an application that allows users to upload photos to it. I needed access to the EXIF data if available, so I assumed I could just use
exif_read_data() and save the results as a JSON blob in the database.Not so simple. I assumed EXIF data was just basic ASCII text, but I assumed wrong. Some values are byte arrays or enums that are encoded with NUL bytes and attempting to serialized them as JSON to be stored in at UTF-8 column failed.
Additionally, I didn't realize that coordinates weren't stored as floating point latitude, longitude pairs that we're familiar with. The EXIF standard doesn't support floating point numbers, so they're encoded as a list of strings that represent the degrees, minutes, and seconds as a fraction (and cardinal direction as a string).
Packagist showed a few existing EXIF libraries, but they looked like overkill for what I needed. So, like every PHP developer, I wrote yet another package named
exif-tools.It's dependency free (aside from the
bcmath, ctype, and exif extensions) and handles a lot of headaches I ran into.Check it out, I'd love to hear your feedback: https://github.com/1tomany/exif-tools
https://redd.it/1qkxgc8
@r_php
GitHub
GitHub - 1tomany/exif-tools: A simple, no dependency PHP library that makes working with EXIF data easier
A simple, no dependency PHP library that makes working with EXIF data easier - 1tomany/exif-tools
Replacement for Encryption-Bundle
In my old Symfony 5 projects, I used the michaeldegroot/doctrine-encrypt bundle to store encrypted data in the database. The bundle worked well and transparently. Now, the project needs to be updated to a current Symfony version, but the encryption bundle no longer works because it only supports ORM2.
Which encryption bundle is currently state-of-the-art for Symfony 7.4/8 and runs as smoothly as the encryption bundle?
https://redd.it/1qkvxjz
@r_php
In my old Symfony 5 projects, I used the michaeldegroot/doctrine-encrypt bundle to store encrypted data in the database. The bundle worked well and transparently. Now, the project needs to be updated to a current Symfony version, but the encryption bundle no longer works because it only supports ORM2.
Which encryption bundle is currently state-of-the-art for Symfony 7.4/8 and runs as smoothly as the encryption bundle?
https://redd.it/1qkvxjz
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
Twig 3.23: Introducing new operators and destructuring support
https://symfony.com/blog/twig-3-23-introducing-new-operators-and-destructuring-support?utm_medium=feed&utm_source=Symfony%20Blog%20Feed
https://redd.it/1ql5o5a
@r_php
https://symfony.com/blog/twig-3-23-introducing-new-operators-and-destructuring-support?utm_medium=feed&utm_source=Symfony%20Blog%20Feed
https://redd.it/1ql5o5a
@r_php
Symfony
Twig 3.23: Introducing new operators and destructuring support (Symfony Blog)
Sharing our PHP libraries
Hey r/PHP,
We have been building and using our own PHP libraries internally for many years across various projects. Figured they might be useful to others.
We're calling them the "Perfect" collection (mainly because our main internal project was called PerfectApp). They're modern, and fully tested with 100% coverage.
After writing our own framework inspired by Laravel for in-house use we went the way of Symfony and made standalone library's that can be used in any modern project. Most of them were developed by real Engineers before the AI boom.
All public releases: https://packagist.org/packages/krubio/
https://redd.it/1qlc71s
@r_php
Hey r/PHP,
We have been building and using our own PHP libraries internally for many years across various projects. Figured they might be useful to others.
We're calling them the "Perfect" collection (mainly because our main internal project was called PerfectApp). They're modern, and fully tested with 100% coverage.
After writing our own framework inspired by Laravel for in-house use we went the way of Symfony and made standalone library's that can be used in any modern project. Most of them were developed by real Engineers before the AI boom.
All public releases: https://packagist.org/packages/krubio/
https://redd.it/1qlc71s
@r_php
packagist.org
The PHP Package Repository
What's your opinion about routes that start with /index.php?
I've noticed that, when using the ServerSideUP
These Docker images are used by Laravel Cloud, so all projects hosted there work the same.
For example, for the Laravel docs page, these routes render the same content:
[https://laravel.com/docs/12.x](https://laravel.com/docs/12.x)
https://laravel.com/index.php/docs/12.x
The same occurs for the Laravel News blog:
[https://laravel-news.com/speeding-up-laravel-news-with-cloudflare](https://laravel-news.com/speeding-up-laravel-news-with-cloudflare)
https://laravel-news.com/index.php/speeding-up-laravel-news-with-cloudflare
I don't know if that's expected, but I personally would expect to remove the
I’ve noticed this because Bing's index started indexing a bunch of URLs with the
https://redd.it/1qlth8e
@r_php
I've noticed that, when using the ServerSideUP
fpm-nginx image with a Laravel project, adding /index.php before the path causes the page to render.These Docker images are used by Laravel Cloud, so all projects hosted there work the same.
For example, for the Laravel docs page, these routes render the same content:
[https://laravel.com/docs/12.x](https://laravel.com/docs/12.x)
https://laravel.com/index.php/docs/12.x
The same occurs for the Laravel News blog:
[https://laravel-news.com/speeding-up-laravel-news-with-cloudflare](https://laravel-news.com/speeding-up-laravel-news-with-cloudflare)
https://laravel-news.com/index.php/speeding-up-laravel-news-with-cloudflare
I don't know if that's expected, but I personally would expect to remove the
/index.php part or even return a 404 Not Found error if the path starts with /index.php because that route doesn't exist in the web.php file.I’ve noticed this because Bing's index started indexing a bunch of URLs with the
/index.php part.https://redd.it/1qlth8e
@r_php
Laravel
Installation - Laravel 12.x - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Once again processing 11 million rows, now in seconds
https://stitcher.io/blog/11-million-rows-in-seconds
https://redd.it/1qq6zwj
@r_php
https://stitcher.io/blog/11-million-rows-in-seconds
https://redd.it/1qq6zwj
@r_php
stitcher.io
A blog about modern PHP, the web, and programming in general. Follow my newsletter and YouTube channel as well.
Once again processing 11 million rows, now in seconds
https://stitcher.io/blog/11-million-rows-in-seconds
https://redd.it/1qq6xqk
@r_php
https://stitcher.io/blog/11-million-rows-in-seconds
https://redd.it/1qq6xqk
@r_php
stitcher.io
A blog about modern PHP, the web, and programming in general. Follow my newsletter and YouTube channel as well.
Looking for sample web projects (HTML, CSS, JS, PHP, Symfony, Bootstrap)
I’m a student currently learning full-stack web development and I’m looking for example projects built with HTML, CSS, JavaScript, PHP (Symfony) and Bootstrap.
If you have an old project, demo, GitHub repo, or practice project you don’t mind sharing, I’d really appreciate it. I’m using them only for learning and understanding structure, best practices, and architecture.
https://redd.it/1qqcsxi
@r_php
I’m a student currently learning full-stack web development and I’m looking for example projects built with HTML, CSS, JavaScript, PHP (Symfony) and Bootstrap.
If you have an old project, demo, GitHub repo, or practice project you don’t mind sharing, I’d really appreciate it. I’m using them only for learning and understanding structure, best practices, and architecture.
https://redd.it/1qqcsxi
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
Best OAuth2 (client) bundle for establishing "clientcredentials" session
To integrate a third-party API with my application, I'll need to establish a session using the OAuth2 "client\credentials" flow. The most popular packages appear to be the "knpu" or "benjaminfavre" bundles.
Based on the readme for each, the "benjaminfavre" bundle appears to be easier to implement, while the "knpu" bundle seems to be more flexible.
All things being equal, I'm leaning toward the "benjaminfavre" bundle, but would be curious to know if anyone has recommendations or concerns?
https://redd.it/1qqj5bj
@r_php
To integrate a third-party API with my application, I'll need to establish a session using the OAuth2 "client\credentials" flow. The most popular packages appear to be the "knpu" or "benjaminfavre" bundles.
Based on the readme for each, the "benjaminfavre" bundle appears to be easier to implement, while the "knpu" bundle seems to be more flexible.
All things being equal, I'm leaning toward the "benjaminfavre" bundle, but would be curious to know if anyone has recommendations or concerns?
https://redd.it/1qqj5bj
@r_php
Reddit
From the symfony community on Reddit
Explore this post and more from the symfony community
Hardening Symfony: Recent Security Improvements
https://symfony.com/blog/hardening-symfony-recent-security-improvements?utm_medium=feed&utm_source=Symfony%20Blog%20Feed
https://redd.it/1qr1895
@r_php
https://symfony.com/blog/hardening-symfony-recent-security-improvements?utm_medium=feed&utm_source=Symfony%20Blog%20Feed
https://redd.it/1qr1895
@r_php
Symfony
Hardening Symfony: Recent Security Improvements (Symfony Blog)
A quick look at recent security hardening improvements that make Symfony safer by default.
Laravel Live Japan – friendly, community-focused Laravel event in Tokyo 🇯🇵
Hey r/laravel
Josh here. 👋 If you don't know who I am, I work in DevRel at Laravel.
I’ll be heading to Laravel Live Japan in Tokyo this May, and I’m really hoping to meet and connect with folks from the Laravel community in Japan and anyone traveling in.
Laravel has such a huge community around the world, so I’m especially excited to see what people are building in Japan and across the wider APAC region.
If you’ve been to a Laravel Live before, the vibe is intentionally more intimate and community-driven than a massive conference. Lots of good conversations and time to actually meet people. I had the privilege of going to Laravel Live UK last year and it was truly one of my favorite times. I met so many incredible people.
Let me know if you’re coming or thinking about it! Happy to answer any questions.
laravellive.jp
https://redd.it/1qqi48a
@r_php
Hey r/laravel
Josh here. 👋 If you don't know who I am, I work in DevRel at Laravel.
I’ll be heading to Laravel Live Japan in Tokyo this May, and I’m really hoping to meet and connect with folks from the Laravel community in Japan and anyone traveling in.
Laravel has such a huge community around the world, so I’m especially excited to see what people are building in Japan and across the wider APAC region.
If you’ve been to a Laravel Live before, the vibe is intentionally more intimate and community-driven than a massive conference. Lots of good conversations and time to actually meet people. I had the privilege of going to Laravel Live UK last year and it was truly one of my favorite times. I met so many incredible people.
Let me know if you’re coming or thinking about it! Happy to answer any questions.
laravellive.jp
https://redd.it/1qqi48a
@r_php
Laravel Live Japan
Join us for Laravel Live Japan, happening May 26-27, 2026 at Tachikawa Stage Garden, Tokyo. Discover what's next for the Laravel ecosystem and connect with a passionate community of developers.
Building a Flexible Reporting System - Laravel In Practice EP3
https://youtu.be/Pa7Gi9raRPk?si=P0XJfrbSPFqVDiZ3
https://redd.it/1qqhld0
@r_php
https://youtu.be/Pa7Gi9raRPk?si=P0XJfrbSPFqVDiZ3
https://redd.it/1qqhld0
@r_php
YouTube
Building a Flexible Reporting System - Laravel In Practice EP3
In this episode, Harris from Laravel News shows you how to:
- Extend query scopes into a complete reporting system
- Add methods for customer insights and daily trends to your order collection
- Implement Top Customers and Daily Breakdown functions
…
- Extend query scopes into a complete reporting system
- Add methods for customer insights and daily trends to your order collection
- Implement Top Customers and Daily Breakdown functions
…
Cycle-accurate NES emulator written in PHP
https://github.com/oliverearl/nes-php-glfw
https://redd.it/1qpg36p
@r_php
https://github.com/oliverearl/nes-php-glfw
https://redd.it/1qpg36p
@r_php
GitHub
GitHub - oliverearl/nes-php-glfw: An NES emulator written in PHP 8.5 using the OpenGL GLFW extension.
An NES emulator written in PHP 8.5 using the OpenGL GLFW extension. - oliverearl/nes-php-glfw