Re:My PHP Problems
by chuckadams on Tuesday February 20, 2024 @02:12PM
(#39445527)
Ah, I'd completely missed that. As for depending on an external library ... get used to it. Writing PHP without any external deps is strictly for one-off scripts -- and rarely even then.
Re:My PHP Problems
by user3939382 on Tuesday February 20, 2024 @02:59PM
(#39446134)
I just wrap the ones I actually need that for and put them in traits (sometimes multiple related per trait). So it's internal, small footprint, and really needs 0 maintenance. This is also good for e.g. json_* when you want to provide app-wide defaults.
> I love the smell of false in the morning, but despite that I do wish that all PHP’s built-in functions threw exceptions. We have the famous safe library which does just that! But if you’re like me then you don’t like coupling huge amounts of code in perpetuity to an external library.