Re: Two-step creation for PHP modules
| From: | Rowan Tommins [IMSoP] | Date: | Wed, 10 Jun 2026 15:24:10 +0000 |
| Subject: | Re: Two-step creation for PHP modules | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131197@lists.php.net to get a copy of this message | ||
On 10 June 2026 14:03:49 BST, "Alex "Pierstoval" Rock"
<pierstoval@gmail.com> wrote:
>Le 10/06/2026 à 12:23, Rowan Tommins [IMSoP] a écrit :
>> That's what I mean by starting with how PHP is used today, and finding ways to enhance
>> it.
>
>
>Creating a namespace doesn't ensure your structures will be internal. In PHP, there's
>nothing today that allow it.
You've missed the point again. I'm not saying that namespaces allow this today. I'm
saying that any attempt to solve problems around packages in PHP should start with the functionality
we already have, and the way the language is actually used.
Take Guzzle, for example; it has 43 source files within a specific namespace root. A handful of
those are marked "@internal", and a way for PHP to error if users reference them directly
would be useful. Some users end up wanting conflicting versions of Guzzle simultaneously, e.g. in
different WordPress plugins; so some way of isolating or rewriting class names (and all their
references) would be useful.
There are not 43 separate "modules", and the maintainers of Guzzle aren't going to
combine all of them into one file. Defining a single package with multiple files is not a stretch
goal, it's the only plausible starting point.
(And before anyone starts whining about Composer and PSR-4, I could find you a PEAR package from 25
years ago and make the same point. Single file packages have *never* been the norm in PHP.)
Rowan Tommins
[IMSoP]