silex webprofiler不显示日志



我正在设置一个silex应用程序,但我不明白为什么我不能从web探查器查看日志。它总是不显示日志。我的作曲家中确实有独白桥,它已经安装好了。。。

composer.json 的相关部分

"minimum-stability": "dev",
    "prefer-stable": true,
    "autoload":{
        "psr-4":{
            "Yamiko\": ["src", "test"]
        }
    },
    "require": {
        "php": ">=5.4.0",
        "silex/silex": "~1.2",
        "symfony/yaml": "v2.3.11",
        "twig/twig": ">=1.8,<2.0-dev",
        "symfony/twig-bridge": "~2.3",
        "doctrine/dbal": "2.2.*",
        "swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev",
        "monolog/monolog": ">=1.0.0",
        "symfony/form": "~2.3",
        "symfony/validator": "~2.3",
        "symfony/config": "~2.3",
        "symfony/translation": "~2.3",
        "symfony/security": "~2.3",
        "kriswallsmith/assetic": "v1.1.2",
        "symfony/finder": "v2.3.11",
        "natxet/CssMin": "3.0.2",
        "silex/web-profiler": "~1.0",
        "symfony/monolog-bridge": "v2.4.2"
    }

index.php

<?php
require './vendor/autoload.php';
use YamikoApp;
$app = new App();
$app->get('/', function(){
    return 'its working!';
});
$app->run();
?>

我的应用程序类

<?php
namespace Yamiko;
use SilexApplication;
use SilexProviderTwigServiceProvider;
use SilexProviderUrlGeneratorServiceProvider;
use SilexProviderSessionServiceProvider;
use SilexProviderValidatorServiceProvider;
use SilexProviderFormServiceProvider;
use SilexProviderHttpCacheServiceProvider;
use SilexProviderHttpFragmentServiceProvider;
use SilexProviderSecurityServiceProvider;
use SymfonyComponentSecurityCoreEncoderBCryptPasswordEncoder;
use SilexProviderRememberMeServiceProvider;
use SilexProviderSwiftmailerServiceProvider;
use SilexProviderMonologServiceProvider;
use SilexProviderTranslationServiceProvider;
use SymfonyComponentTranslationLoaderYamlFileLoader;
use SilexProviderDoctrineServiceProvider;
use SilexProviderServiceControllerServiceProvider;
use SilexProviderWebProfilerServiceProvider;
class App extends Application{
    use ApplicationTwigTrait;
    use ApplicationSecurityTrait;
    use ApplicationFormTrait;
    use ApplicationUrlGeneratorTrait;
    use ApplicationSwiftmailerTrait;
    use ApplicationMonologTrait;
    use ApplicationTranslationTrait;
    public function __construct(array $values = array()) {
        parent::__construct($values);
        // monolog
        $this->register(new MonologServiceProvider(), array(
            'monolog.name' => 'yamiko',
            'monolog.level' => 100,
            'monolog.logfile' => __DIR__ . 'Yamiko/cache/yamiko.log',
        ));
        // http cache
        $this->register(new HttpCacheServiceProvider(), array(
            'http_cache.cache_dir' => __DIR__ . '/cache/http/',
        ));
        // http fragments used for ESI and hincludes
        $this->register(new HttpFragmentServiceProvider());
        // UrlGeneratorServiceProvider
        $this->register(new UrlGeneratorServiceProvider());
        // service controller
        $this->register(new ServiceControllerServiceProvider());
        // TranslationServiceProvider
        $this->register(new TranslationServiceProvider(), array(
            'locale_fallbacks' => array('en'),
        ));
        $this['translator'] = $this->share($this->extend('translator', function($translator, $this) {
            $translator->addLoader('yaml', new YamlFileLoader());
            $translator->addResource('yaml', 'Yamiko/locales/en.yml', 'en');
            $translator->addResource('yaml', 'Yamiko/locales/es.yml', 'es');
            $translator->addResource('yaml', 'Yamiko/locales/fr.yml', 'fr');
            return $translator;
        }));
        // FormServiceProvider
        $this->register(new FormServiceProvider());
        // validator
        $this->register(new ValidatorServiceProvider());
        // SecurityServiceProvider
        $this->register(new SecurityServiceProvider());
        $this->register(new RememberMeServiceProvider());
        // @TODO configure remember me provider
        $this['security.firewalls'] = array(
            'admin' => array(
                'pattern' => '^/admin',
                'http' => true,
                'users' => array(
                    // raw password is foo
                    'admin' => array('ROLE_ADMIN', '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg=='),
                ),
            ),
        );
        $this['security.encoder.digest'] = $this->share(function ($this) {
            // use the sha1 algorithm
            // don't base64 encode the password
            // use only 1 iteration
//            return new MessageDigestPasswordEncoder('sha1', false, 1);
            return new BCryptPasswordEncoder(10);
        });
        // twig
        $this->register(new TwigServiceProvider(), array(
            'twig.path' => 'Yamiko/views',
            'twig.options' => array(
                'debug' => $this['debug'],
                'cache' => 'Yamiko/cache/views/',
                'optimizations' => -1,
                'strict_variables' => true,
                'autoescape' => true,
                'charset' => 'utf-8',
                'auto_reload' => $this['debug']
            )
        ));
        $this['twig'] = $this->share($this->extend('twig', function($twig, $app) {
//            $twig->addGlobal('pi', 3.14);
//            $twig->addFilter('levenshtein', new Twig_Filter_Function('levenshtein'));
            return $twig;
        }));
        // sessions
//        $this['cookie_lifetime'] = 0;// can be used to set an explicit cookie lifetime.
        $this->register(new SessionServiceProvider());
        // swift mailer
        $this->register(new SwiftmailerServiceProvider());
        $this['swiftmailer.options'] = array(
            'host' => 'localhost',
            'port' => '25',
            'username' => '',
            'password' => '',
            'encryption' => null,
            'auth_mode' => null
        );
        // profiler
        $this->register($p = new WebProfilerServiceProvider(), array(
            'profiler.cache_dir' => __DIR__ . 'Yamiko/cache/profiler',
            'profiler.mount_prefix' => '/_profiler', // this is the default
        ));
        $this->mount('/_profiler', $p);
    }
}

这是由一个错误引起的。不再是问题。https://github.com/silexphp/Silex-WebProfiler/pull/38

相关内容

  • 没有找到相关文章

最新更新