Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using USE and Namespace (composer)in sample php file

I have sample PHP file, i run composer install and got Monolog library. when I trying their installation guide I get error 500.

When I put the following code in sample file I get error 500 on new Logger row. Maybe I have autoloader? Is it possible to use without it?

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));

// add records to the log
$log->warning('Foo');
$log->error('Bar');
like image 403
Tuz Avatar asked May 29 '26 13:05

Tuz


1 Answers

using autoloader fixed that used that solution : https://github.com/Nilpo/autoloader/blob/master/Autoloader.php

like image 128
Tuz Avatar answered Jun 01 '26 02:06

Tuz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!