Re: debugging php webapps

Ashley Sheridan <[email protected]> Tue, 28 Jan 2025 16:31:55 +0000
Newsgroups gmane.comp.php.general
Message-ID <[email protected]>
On 28/01/2025 15:47, bruce wrote:
> Hi Ashley.
>
> Thanks for the reply.
>
> Eloquent?  PhpStorm! You guys are always making someone hit up the net 
> to check out things!
>
> But on a serious note, your mention of the IDE implies the local 
> system, with "X". However, when dealing with a remote "server", the 
> setup may not allow the IDE construct to be deployed. So you're left 
> with the cmdline.
>
> thanks
>
>
> On Tue, Jan 28, 2025 at 8:00 AM Ashley Sheridan 
> <[email protected]> wrote:
>
>     On 28/01/2025 12:47, bruce wrote:
>
>     > Hi.
>     >
>     > Looking over different articles.. Figured I'd post here as well.
>     >
>     > What tools are used to debug webapps/php apps?
>     >
>     > Treat the user/reader as a 6 year old!
>     >
>     > What setups, what tools, what sites have you found that detail the
>     > "tricks"
>     >
>     > I'm looking at firing up some bootstrap/laravel webapps, and I'm
>     going
>     > to want to get to the level of understanding "as fast as possible"
>     > regarding front-side/serverside interaction, and/or bootstrap
>     > integration to laravel.
>     >
>     > thanks much!
>     >
>     >
>     >
>     For Laravel apps, Debugbar
>     (https://github.com/barryvdh/laravel-debugbar
>     ) is a massive boon, and is especially helpful when you're using a
>     lot
>     of related models with Eloquent as it can help you identify where to
>     optimise in order to avoid too many SQL queries where fewer would do.
>     However, it doesn't work on API routes, just the web ones.
>
>     For all other PHP debugging, then XDebug has always been my go-to.
>     It's
>     easy to set up, integrates nicely with PHPStorm and Visual Studio
>     Code,
>     and has the added benefit of being able to pretty print errors
>     (although
>     that's more useful outside of a framework, as Laravel has its own
>     built-in pretty print for errors).
>
>     Ashley Sheridan
>     Web developer and accessibility advocate
>     https://ashleysheridan.co.uk
>
Please keep replies on list for the benefit of everyone. You can use the 
reply to list feature of your email client for this.

Eloquent is the ORM that Laravel uses. You basically create models that 
map to key data object tables in your DB, and you can create relations 
between models using a few lines of code. It's pretty intuitive, and the 
Laravel docs are great.

You can using XDebug to debug a remote system, but I wouldn't recommend 
it, as XDebug doesn't belong on a production system. It will greatly 
slow things down, and by its very nature you would be potentially 
exposing way more information about your server than you should be.

If you want to debug a production system, you can enable error logging 
(never display errors in production) and go through those. There are 
monitoring solutions out there like BugSnag and Sentry. There's also 
GlitchTip which places itself as a free Sentry compatible clone although 
I've not tried that one)

Ashley Sheridan
Web developer and accessibility advocate
https://ashleysheridan.co.uk