41

我正在尝试重新部署我一直在从事的 Symfony 2.1x 项目,app_dev.php但由于找不到app/bootstrap.php.cache. 由于我使用了 Symfony2 的推荐文件,因此在项目的 git 存储库中省略了该.gitignore文件:

# .gitignore
/app/bootstrap*

我认为app/bootstrap.php.cache在此过程中产生的想法是否正确$ php composer.phar install?如果是这种情况,那么我将为您包括我的composer.json

// composer.json
{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": "2.2.*",
        "doctrine/doctrine-bundle": "dev-master",
        "twig/extensions": "dev-master",
        "symfony/assetic-bundle": "dev-master",
        "symfony/swiftmailer-bundle": "dev-master",
        "symfony/monolog-bundle": "dev-master",
        "sensio/distribution-bundle": "dev-master",
        "sensio/framework-extra-bundle": "dev-master",
        "sensio/generator-bundle": "dev-master",
        "jms/security-extra-bundle": "1.1.*",
        "jms/di-extra-bundle": "1.0.*",
        "ddeboer/guzzle-bundle": "dev-master",
        "mopa/bootstrap-bundle": "dev-master",
        "twitter/bootstrap": "master",
        "knplabs/knp-paginator-bundle": "dev-master",
        "knplabs/knp-menu-bundle": "dev-master",
        "craue/formflow-bundle": "dev-master"
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "version": "master",
                "name": "twitter/bootstrap",
                "source": {
                    "url": "https://github.com/twitter/bootstrap.git",
                    "type": "git",
                    "reference": "master"
                },
                "dist": {
                    "url": "https://github.com/twitter/bootstrap/zipball/master",
                    "type": "zip"
                }
            }
        }
    ],
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-install-cmd": [
            "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
        ],
        "post-update-cmd": [
            "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web"
    }
}

我怎样才能生成bootstrap.php.cache

4

4 回答 4

76

只需转到您的项目并使用作曲家生成它

php /path/to/composer/composer.phar install
于 2012-12-10T18:46:02.850 回答
11

只需运行以下命令。

php composer.phar install

来源: http ://symfony.com/doc/master/book/performance.html#use-bootstrap-files

于 2015-08-05T14:01:02.983 回答
4

您已经复制了post-install-cmdpost-updated-cmd虽然您应该将 MopaBootstrapBundle 脚本添加到现有密钥。尝试以下 composer.json 并重新运行php composer.phar install

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": "2.2.*",
        "doctrine/doctrine-bundle": "dev-master",
        "twig/extensions": "dev-master",
        "symfony/assetic-bundle": "dev-master",
        "symfony/swiftmailer-bundle": "dev-master",
        "symfony/monolog-bundle": "dev-master",
        "sensio/distribution-bundle": "dev-master",
        "sensio/framework-extra-bundle": "dev-master",
        "sensio/generator-bundle": "dev-master",
        "jms/security-extra-bundle": "1.1.*",
        "jms/di-extra-bundle": "1.0.*",
        "ddeboer/guzzle-bundle": "dev-master",
        "mopa/bootstrap-bundle": "dev-master",
        "twitter/bootstrap": "master",
        "knplabs/knp-paginator-bundle": "dev-master",
        "knplabs/knp-menu-bundle": "dev-master",
        "craue/formflow-bundle": "dev-master"
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "version": "master",
                "name": "twitter/bootstrap",
                "source": {
                    "url": "https://github.com/twitter/bootstrap.git",
                    "type": "git",
                    "reference": "master"
                },
                "dist": {
                    "url": "https://github.com/twitter/bootstrap/zipball/master",
                    "type": "zip"
                }
            }
        }
    ],
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web"
    }
}
于 2012-08-14T20:33:22.273 回答
0

就我而言,我的作曲家版本是 2.x,所需的版本是 1.x 所以,首先我需要降级到版本 1,然后我运行 composer install

sudo composer self-update --1 && composer install -v --prefer-dist
于 2021-09-26T08:10:12.640 回答