문제

Monolog : http://github.com/Seldaek/monolog

Symfony Class Loader : https://github.com/symfony/ClassLoader

As per the usage instructions on the Monolog site, I'm trying to load the class loader to load monolog in my php project. I cant get 'Composer' installed on my machine (firewall problems from my work machine), so I'm trying to follow the instructions on monolog and symfony sites but I'm having issues.

Here is my SAMPLE of my directory structure with my php code :

myProj/
--ClassLoader/            (symfony)
----UniversalClassLoader.php
--Monolog/ 
----Formatter/
----Handler/
----Processor/
----Logger.php
--myPhpFile.php

And here is my php code to attempt to 'require' monolog

require_once(realpath('ClassLoader/UniversalClassLoader.php'));   
$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$loader->register();
$loader->registerNamespace('Monolog', realpath('Monolog'));
require_once(realpath('Monolog\Logger.php'));    //exception generated here! :-(

and here is the php exception I'm getting inside the Monolog\Logger.php as soon as it attempts to 'require' monolog

Interface 'Psr\Log\LoggerInterface' not found

but I cant even FIND anything that looks like a 'psr\log' namespace in the monolog code. What bits am I missing?

도움이 되었습니까?

해결책

Psr\Log is a dependency of monolog, if you are not using Composer you'll have to track down all dependencies and it's probably not going to be fun (though for monolog there is only the psr-log package). If you really want you can find it at https://github.com/php-fig/log - but you could also try to download composer via your browser, just grab https://getcomposer.org/composer.phar

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top