Monday, April 3, 2017

How to debug multiple dependant php files in a browser?

I am new to PHP and Laravel.

I am quite confused about debugging such application. I've set up idea IDE and xdebug, installed Laravel plugin, run apache server, etc.

Right now i have this line of code in my /App/MaterialDivider.php

$provision = \Config::get('constants.MARKET_PROVISION');

and this in my \config\constants.php

return [ 'MARKET_PROVISION' => 0.3 ];

When I run artisan commands in my vagrant homestead box, this way of calling constants works within my seeder file. The problem is that I don't know how to make Laravel work when I run single file in a browser.

Apart from that, a simple

dd($var)

doesn't work either.

When working with multiple files that contain dependant classes, is it necessary to include them? Or should using 'use' be enough? Or is editing composer.json (maybe autoload-dev section?) the right choice?

So far I've been programming in C(++), so this is all very new for me, please be patient.

Partialy [SOLVED]. To anyone having similar problems: namespaces are the thing, you might be looking for.



via Rook

Advertisement