PHP

Invading private properties and methods in PHP

[AdSense-A]

Last week, Caleb tweeted about a nifty function called invade - that he had made to easily work with private properties and methods.

😈 Whatcha think of my new favorite helper method?

That property/method protected or private? No problemoooo 🔓 pic.twitter.com/HqMXKKpRsJ

— Caleb Porzio (@calebporzio) February 11, 2022

He added that invade function to Livewire. Because I could see myself using this in non-Laravel projects, I packaged up the function in a new package called spatie/invade.

(more…)

By , ago