我已经通过作曲家安装了Twitter bootstrap,并且不知道如何在树枝视图中引用它。我认为它有一个命名空间,但我不能得到它。
在这个类似的问题中:How to setup bootstrap after downloading via composer?他们使用工匠解决这个问题,但如何在苗条的PHP中做到这一点?
我的文件夹结构:
├── app
│ ├── controllers
│ ├── models
│ └── templates
├── composer.json
├── composer.lock
├── config
│ └── local.php
├── logs
│ ├── README.md
│ └── app.log
├── public
│ ├── css
│ └── index.php
├── src
│ ├── dependencies.php
│ ├── middleware.php
│ ├── routes.php
│ └── settings.php
└── vendor
├── autoload.php
├── bin
├── composer
├── container-interop
├── doctrine
├── illuminate
├── monolog
├── nesbot
├── nikic
├── paragonie
├── pimple
├── psr
├── slim
├── symfony
├── twbs
└── twig
Composer.json文件:
{
"name": "slim/slim-skeleton",
"description": "A Slim Framework skeleton application for rapid development",
"keywords": [
"microframework",
"rest",
"router",
"psr7"
],
"homepage": "http://github.com/slimphp/Slim-Skeleton",
"license": "MIT",
"authors": [
{
"name": "Josh Lockhart",
"email": "info@joshlockhart.com",
"homepage": "http://www.joshlockhart.com/"
}
],
"require": {
"php": ">=5.5.0",
"slim/slim": "^3.1",
"monolog/monolog": "^1.17",
"illuminate/database": "~5.1",
"slim/twig-view": "^2.1",
"twbs/bootstrap": "^3.3"
},
"autoload": {
"psr-4": {
"App\\Models\\": "app/models",
"App\\Controllers\\": "app/controllers"
}
}
}
答案 0 :(得分:1)
您可以设置一个编辑器挂钩来自动将文件复制到您的公共目录:
{
"scripts": {
"post-update-cmd": "cp vendor/twbs/bootstrap/dist/css/bootstrap.css public/",
"post-install-cmd": "cp vendor/twbs/bootstrap/dist/css/bootstrap.css public/"
}
}
这应该进入composer.json 注意:未经测试但应该有效。