PHP Reddit – Telegram
PHP Reddit
34 subscribers
286 photos
36 videos
24.7K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
soo the thing i anticipate the most has been asleep for 3 months. is it finished and just waiting for juicy release date? what do you think?
https://redd.it/1ph76g5
@r_php
[Research] Tool to Trace Model and Event Usage in Laravel Projects

I'm working on a tool that shows how models get used in a Laravel project, but in a way normal users can understand. Kind of like PhpStorm’s "find usages", but shown in a simple dashboard for managers or anyone who isn't deep into the code

The idea is that you click a model or a method and see the path of what touches it: `action → controller → route`. I want to do the same for listeners, jobs, events, and anything else that runs when something happens in the app

Basically I want to answer things like:

* what happens when a user gets created
* which listeners run when a user is updated
* which jobs fire when a post is created

I'm trying to figure out if this would be useful for others as an open-source tool. You would import your Laravel project into it and get all these insights about what cals what and what runs when things happen

https://redd.it/1phe7ua
@r_php
🚀 Bare Metal PHP: a very lightweight PHP framework with a Go-powered app server (fast workers + slow workers, hot reload, persistent PHP workers)

I’ve been teaching myself framework design and accidentally built something weird (PHP framework + Go app server). It started off as a lightweight Laravel clone -- I wanted to create something with the feel of

Hey everyone — I’m still pretty new to framework architecture and backend engineering in general, so please go easy on me 😅

I’ve been building a PHP framework *just so I could understand how Laravel/Symfony/etc. actually work under the hood*. This was supposed to be a small personal learning project… but it sort of spiraled into something more interesting, and I’m honestly unsure if I’ve built something cool or wasted a *ton* of time.

I just released **Bare Metal PHP v0.2.0**, and the part I’m most unsure/excited about is:

# I wrote a Go application server that runs PHP through persistent workers

I started looking into Swoole/RoadRunner, but thought it would be interesting/cool to build a Go app server built-in to the PHP framework without needing to install a binary or configure extensions.

So I wrote a Go front-end server that:

* keeps a pool of persistent PHP workers alive
* routes “slow” requests (uploads, reports, heavy endpoints) to a separate pool
* supports automatic hot reload
* serves static files instantly
* talks to PHP using a binary header + JSON payload bridge

You can install it via:

php mini go:install
go mod tidy
php mini go:serve

Before this, I had never written anything serious in Go OR designed a worker protocol, and my primary goal was just to mess around and learn new things, which I definitely have. I'm looking for some feedback on what direction I could take this.

**What the framework itself includes:**

It’s still early, but right now it has:

* routing + controller auto-resolution
* requests/responses
* view layer
* migrations + rollback batches
* SQLite/MySQL/Postgres support
* simple service container
* artisan-like console (`php mini`)
* full PHPUnit test suite (176 tests atm)

Skeleton app installs via:

composer create-project baremetalphp/baremetalphp myapp

Framework code is here:
[**https://github.com/baremetalphp/framework**]()

Docs are here:
[**https://baremetalphp.com**]()

tbh, just looking for some honest feedback :)

Hey everyone — I’m still pretty new to framework architecture and backend engineering in general, so please go easy on me 😅

This whole project started because I wanted to understand how Laravel, Symfony, etc. actually work under the hood. I planned to build a tiny Laravel-ish clone just for learning… but it spiraled into something much bigger, and now I’m honestly not sure if I built something cool or if I just wasted a ton of time.

I just released BareMetalPHP v0.2.0, and the part I’m most unsure/excited about is this:

# I wrote a Go application server that runs PHP through persistent workers

I had been reading about RoadRunner and Swoole, but I thought it would be fun (and educational) to try building a Go app server built directly into the PHP framework, without needing to install any external binaries or PHP extensions.

So I ended up writing a Go front-end server that:

* keeps a pool of persistent PHP workers alive
* separates “slow” requests (uploads, reports, heavy endpoints) into their own worker pool
* supports automatic hot reload
* serves static files extremely fast
* communicates with PHP using a simple binary header + JSON payload protocol

You can try it out with:

php mini go:install
go mod tidy
php mini go:serve

Before this I had never written anything serious in Go or designed a worker protocol, and the main goal was just to learn — which I definitely did. Now I’m trying to figure out what direction (if any) this should go next.

# What the framework currently includes:

It’s still early, but right now Bare Metal PHP has:

* routing + controller auto-resolution
* requests / responses
* a simple view layer
* migrations + rollback batches
* SQLite /
MySQL / Postgres support
* a lightweight service container
* an artisan-style console (php mini)
* a full PHPUnit test suite (176 tests so far)

Skeleton app install:

composer create-project baremetalphp/baremetalphp myapp

Code: [https://github.com/baremetalphp/framework](https://github.com/baremetalphp/framework)
Docs: [https://baremetalphp.com](https://baremetalphp.com)

I’m posting this mainly because I’d love honest feedback — good or bad.
I’m still learning, so if I made awful architectural decisions or reinvented things poorly, I'd genuinely appreciate hearing it.

Thanks for reading 🙏

https://redd.it/1phoz2m
@r_php
Announcing Watchtower: open-source server and application monitoring for Laravel

I'm happy to release Watchtower: open-source server and application monitoring for Laravel.

I've been using Watchtower personally for years. It sends me alerts when something goes wrong with my Laravel applications or my servers. Three months ago I did a "laravel new", and now I'm happy to finally release it open-source.

You can find Watchtower over at https://watchtower.dev

I also made a YouTube video that shows off the installation process and some of the features.

Watchtower definitely isn't finished yet (it doesn't send out disk usage alerts yet, for example). There's a roadmap on the website with features that I'd like to add in the coming months.

If you have any questions, feel free to post them below

https://redd.it/1pi0v7q
@r_php
Djot PHP: A modern markup parser for PHP 8.2+ (upgrade from markdown)

# Hey r/PHP,

I've released a PHP implementation of Djot, a lightweight markup language created by John MacFarlane (also the author of Pandoc and CommonMark).

# Why Djot?

If you've ever wrestled with Markdown edge cases - nested emphasis acting weird, inconsistent behavior across parsers - Djot was designed to fix that. Same familiar feel, but with predictable parsing rules.

I wanted to replace my markdown-based blog handling (which had plenty of edge case bugs). After looking into various modern formats, Djot stood out as a great balance of simplicity and power.

I was surprised it didn't have PHP packages yet. So here we are :)

# Some things Djot has or does better

|Feature|Markdown|Djot|
|:-|:-|:-|
|Highlight|Not standard|{=highlighted=}|
|Insert/Delete|Not standard|{+inserted+} / {-deleted-}|
|Supernoscript|Not standard|E=mc^2^|
|Subnoscript|Not standard|H~2~O|
|Attributes|Not standard|{.class #id} on any element|
|Fenced divs|Raw HTML only|::: warning ... :::|
|Raw formats|HTML only|``code{=html} for any format|
|Parsing|Backtracking, edge cases|Linear, predictable|

# Features

Full Djot syntax support with 100% official test suite compatibility
AST-based architecture for easy customization
Event system for custom rendering and extensions
Converters: HTML-to-Djot, Markdown-to-Djot, BBCode-to-Djot
WP plugin and PHPStorm/IDE support

# Quick example

use Djot\DjotConverter;

$converter = new DjotConverter();
$html = $converter->convert('
Strong and _emphasized_ with {=highlights=}');
// <p><strong>Strong</strong> and <em>emphasized</em> with <mark>highlights</mark></p>

All details in my post:
[
https://www.dereuromark.de/2025/12/09/djot-php-a-modern-markup-parser/](https://www.dereuromark.de/2025/12/09/djot-php-a-modern-markup-parser/)

# Links

GitHub: https://github.com/php-collective/djot-php
Live sandbox: [https://sandbox.dereuromark.de/sandbox/djot](https://sandbox.dereuromark.de/sandbox/djot)
Djot spec: https://djot.net

Install via Composer: composer require php-collective/djot

What do you think? Is Djot something you'd consider using in your projects? Would love to hear feedback or feature requests!

https://redd.it/1pi07vp
@r_php
Yii Active Record 1.0

We are pleased to present the first stable release of [Yii Active Record](https://github.com/yiisoft/active-record) — an implementation of the [Active Record pattern](https://wikipedia.org/wiki/ActiveRecord) for PHP.

The package is built on top of [Yii DB](https://github.com/yiisoft/db), which means it comes with out-of-the-box support for major relational databases: PostgreSQL, MySQL, MSSQL, Oracle, SQLite.

**Flexible Model Property Handling**

* Dynamic properties — fast prototyping with #\[\\AllowDynamicProperties\]
* Public properties
* Protected properties — encapsulation via getters/setters
* Private properties
* Magic properties

**Powerful Relation System**

* One-to-one
* One-to-many
* Many-to-one
* Many-to-many — three implementation approaches (junction table, junction model, key array)
* Deep relations — access to related records through intermediate relations
* Inverse relations
* Eager loading — solves the N+1 problem

**Extensibility via Traits**

* `ArrayableTrait` — convert a model to an array
* `ArrayAccessTrait` — array-style access to properties
* `ArrayIteratorTrait` — iterate over model properties
* `CustomConnectionTrait` — custom database connection
* `EventsTrait` — event/handler system
* `FactoryTrait` — [Yii Factory](https://github.com/yiisoft/factory) integration for DI
* `MagicPropertiesTrait` and `MagicRelationsTrait` — magic accessors
* `RepositoryTrait` — repository pattern

**Additional Features**

* Optimistic Locking — concurrency control using record versioning
* Dependency Injection — support for constructor-based injection
* Flexible configuration — multiple ways to define the database connection

**Example**

Example AR class:

/**
* Entity User
*
* Database fields:
* @property int $id
* @property string $username
* @property string $email
**/
#[\AllowDynamicProperties]
final class User extends \Yiisoft\ActiveRecord\ActiveRecord
{
public function tableName(): string
{
return '{{%user}}';
}
}

And its usage:

// Creating a new record
$user = new User();
$user->set('username', 'alexander-pushkin');
$user->set('email', 'pushkin@example.com');
$user->save();

// Retrieving a record
$user = User::query()->findByPk(1);

// Read properties
$username = $user->get('username');
$email = $user->get('email');

https://redd.it/1pi1mlk
@r_php
Confusing docs versioning for 1st party packages

The https://laravel.com/docs site supports switching between different framework versions, which is great. But documentation for first party packages can be super confusing, since their versions are independent of the framework version.

Example: https://laravel.com/docs/12.x/passport
Which version of the Passport package is documented here? That's right, v13. That fact is not mentioned anywhere in the docs.
Due to a constraint on symfony/psr-http-message-bridge, composer installed Passport v12 in my project. It took a while to figure out why I couldn't find the `OAuthenticatable` interface. How are users supposed to know that Passport v12 is documented under v11 in the docs?



https://redd.it/1pi3vk9
@r_php
Laravel eCommerce Extension – GST Management

Hello,

I’d like to share a Bagisto extension that you might find useful:

Extension: Laravel eCommerce GST Extension

Link: https://bagisto.com/en/extensions/laravel-ecommerce-gst-extension/



With this extension, you can automatically calculate Goods and Services Tax (GST) for products and orders in your Laravel eCommerce store. It ensures accurate tax computation based on customer location, product type, and applicable GST rates.

The extension supports various GST types, such as CGST, SGST, and IGST. It also helps you display taxes clearly on product pages, cart, checkout, and invoices, ensuring compliance with Indian tax regulations.



You can configure it to:

Apply GST automatically based on state and product category.

Show tax-inclusive or tax-exclusive prices to customers.

Generate tax reports for accounting and filing purposes.



This extension simplifies tax management, reduces errors, and ensures your store complies with GST rules without any manual effort.

https://redd.it/1pi71ks
@r_php
Roast My EAV implementation..I need your feedback

I had done a different approach in one of the project

Setup

- We define all the different types of custom fields possible . i.e Field Type

- Next we decided the number of custom fields allowed per type i.e Limit

- We created 2 tables 1) Custom Field Config 2) Custom Field Data

- Custom Field Data will store actual data

- In the custom field data table we pre created columns for each type as per the decided allowed limit.

- So now the Custom Field Data table has Id , Entity class, Entity Id, ( limit x field type ) . May be around 90 columns or so

- Custom Field Config will store the users custom field configuration and mapping of the column names from Custom Field Data


Query Part

- With this setup , the query was easy. No multiple joins. I have to make just one join from the Custom Field Table to the Entity table

- Of course, dynamic query generation is a bit complex . But it's actually a playing around string to create correct SQL

- Filtering and Sorting is quite easy in this setup

Background Idea

- Database tables support thousands of columns . You really don't run short of it actually

- Most users don't add more than 15 custom fields per type

- So even if we support 6 types of custom fields then we will add 90 columns with a few more extra columns

- Database stores the row as a sparse matrix. Which means they don't allocate space in for the column if they are null


I am not sure how things work in scale.. My project is in the early stage right now.

Please roast this implementation. Let me know your feedback.

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