innmind / debug
Set of tools to help debug applications
Requires
- php: ~8.2
- innmind/framework: ~2.0
- innmind/http: ~7.0
- innmind/object-graph: ~3.1
- innmind/profiler: ~4.0
- innmind/stack-trace: ~4.0
Requires (Dev)
- innmind/black-box: ~5.5
- innmind/coding-standard: ~2.0
- vimeo/psalm: ~5.6
Provides
README
Profiler client to help debug applications.
Installation
composer require --dev innmind/debug
Usage
use Innmind\Framework\{ Application, Main\Http, // this example also works with Main\Cli Middleware\Optional, }; use Innmind\Profiler\Web\Kernel as Profiler; use Innmind\Debug\Kernel as Debug; use Innmind\Url\Path; new class extends Http { protected function configure(Application $app): Application { return $app ->map(Optional::of( Debug::class, static fn() => Debug::inApp()->operatingSystem(), )) ->map(new YourAppKernel) ->map(Optional::of( Profiler::class, static fn() => Profiler::inApp(Path::of('var/profiler/')), )) ->map(Optional::of( Debug::class, static fn() => Debug::inApp()->app(), )); } };
The first middleware will record calls to the operating system, you can omit this middleware if you don't want to record it. This middleware is defined first so all decorators to the OperatingSystem
will be recorded, such as redirections for http calls.
Note
if you don't want to record low level calls to the OS but the one initiated by your app you can define a single middleware via Optional::of(Debug::class, static fn() => Debug::inApp())
as the last middleware.
The Profiler
middleware adds the route GET /_profiler/
where you'll find all the recorded profiles. The profiles are stored in the local var/profiler/
in clear text.
The last middleware is the one that initiates the recording of profiles.