pierstoval, French
@pierstoval@mastodon.social avatar

Hey #php folks: is it possible to hook into the "include", "include_once", "require" and "require_once" calls, like with a C extension or something?

awoodsnet,
@awoodsnet@phpc.social avatar

@pierstoval i have no idea. But let’s pretend that you could — What would you do with it?

pierstoval,
@pierstoval@mastodon.social avatar

@awoodsnet Log it somewhere to know specific php files usage on a legacy app

awoodsnet,
@awoodsnet@phpc.social avatar
pierstoval,
@pierstoval@mastodon.social avatar

@awoodsnet IIRC xdebug is made for profiling requests one by one, I'm more looking at something that what an APM does, but on a wayyyy smaller scale (just logging include/require calls)

awoodsnet,
@awoodsnet@phpc.social avatar

@pierstoval there might be a static analysis tool, but don’t know which one. maybe phpstan?

Anyway, i thought maybe the shell could help you. i made a gist you can try. you’ll need to have RipGrep (rg) installed. Run it from your project root. https://gist.github.com/andrewwoods/0ae9b7e417eb049d95d588dc5be4ca60

pierstoval,
@pierstoval@mastodon.social avatar

@awoodsnet I already have used static analysis for another use-case, but that's not what I want for the new use-case.

In this case I want runtime usage, this has to be run for at least a month to determine general usage of the legacy app. It's easier for now than inquiring an investigation to the actual users, we found.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines