【问题标题】:There is no extension able to load the configuration for "security"没有扩展能够加载“安全”的配置
【发布时间】:2019-08-12 05:22:44
【问题描述】:

我正在尝试创建一个具有安全登录空间的管理员面板。我为此安装了 Security-bundle。

但是,我收到此错误:

没有扩展能够加载“安全”的配置 (在 (..)/devfuzz/config/packages/security.yaml 中)。看着 对于命名空间“security”,找到“framework”、“web_server”、“maker”, “教义缓存”,“教义”,“教义迁移”,“树枝”, “swiftmailer”、“sensio_framework_extra”、“knp_paginator” /home/fuzzdesize/devfuzz/config/packages/security.yaml(即 加载到资源中 “/home/fuzzdesize/devfuzz/config/packages/security.yaml”)。

我的 Composer.json :

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "doctrine/annotations": "^1.6",
        "knplabs/knp-paginator-bundle": "^3.0",
        "sensio/framework-extra-bundle": "^5.2",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "4.2.*",
        "symfony/console": "4.2.*",
        "symfony/dotenv": "4.2.*",
        "symfony/flex": "^1.1",
        "symfony/form": "4.2.*",
        "symfony/framework-bundle": "4.2.*",
        "symfony/http-foundation": "4.2.*",
        "symfony/orm-pack": "^1.0",
        "symfony/security-bundle": "4.2.*",
        "symfony/swiftmailer-bundle": "^3.2",
        "symfony/translation": "4.2.*",
        "symfony/twig-bundle": "4.2.*",
        "symfony/validator": "4.2.*",
        "symfony/web-server-bundle": "4.2.*",
        "symfony/yaml": "4.2.*",
        "twig/twig": "^2.0"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.2.*"
        }
    },
    "require-dev": {
        "symfony/maker-bundle": "^1.11"
    }
}

我的 bundles.php :

<?php

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
    Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
    Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
    Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
    Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
    Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
    Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
    Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
];

我可以看到安全性不在 bundles.php 文件中。那么我该如何添加呢?它会解决问题吗?还是我需要做其他事情?

【问题讨论】:

标签: php symfony symfony4


【解决方案1】:

好像是security-bundle的安装没有在bundles.php中自动添加bundle security这一行。

我通过手动添加该行解决了这个问题:

Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true ],

【讨论】:

  • 非常感谢!!我有同样的错误,但包完全不同。但是您的解决方案也对我有所帮助。我可能已经搜索了好几天没有你的解决方案(Symfony 初学者)!
猜你喜欢
  • 2016-07-03
  • 2013-04-13
  • 1970-01-01
  • 1970-01-01
  • 2021-03-09
  • 2013-09-19
  • 1970-01-01
  • 2018-04-22
  • 1970-01-01
相关资源
最近更新 更多