|
| 1 | +Installation |
| 2 | +============ |
| 3 | + |
| 4 | +Prerequisites |
| 5 | +------------- |
| 6 | + |
| 7 | +### Less (recommended) |
| 8 | + |
| 9 | +Less is not required, but is extremely helpful when using bootstrap2 variables, or mixins, |
| 10 | +If you want to have a easier life, have a look into: |
| 11 | +If you do not have less installed, currently you have several option, but please do NOT ask for help. |
| 12 | + |
| 13 | +[Less Documentation](https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/doc/less-installation.md) |
| 14 | + |
| 15 | +Installation |
| 16 | +------------ |
| 17 | + |
| 18 | +1. Add this bundle to your project in composer.json: |
| 19 | + |
| 20 | + 1.2. Plain BootstrapBundle |
| 21 | + symfony 2.1 uses composer (http://www.getcomposer.org) to organize dependencies: |
| 22 | + |
| 23 | + ```json |
| 24 | + { |
| 25 | + "require": { |
| 26 | + "mopa/bootstrap-bundle": "dev-master", |
| 27 | + } |
| 28 | + } |
| 29 | + ``` |
| 30 | + 1.2. BootstrapBundle and twitters bootstrap |
| 31 | + |
| 32 | + To have composer managing twitters bootstrap too, you can either run it with |
| 33 | + --install-suggests or add the following to your composer.json: |
| 34 | + |
| 35 | + ```json |
| 36 | + { |
| 37 | + "require": { |
| 38 | + "mopa/bootstrap-bundle": "dev-master", |
| 39 | + "twitter/bootstrap": "master" |
| 40 | + }, |
| 41 | + "repositories": [ |
| 42 | + { |
| 43 | + "type": "package", |
| 44 | + "package": { |
| 45 | + "version": "master", /* whatever version you want */ |
| 46 | + "name": "twitter/bootstrap", |
| 47 | + "source": { |
| 48 | + "url": "https://github.com/twitter/bootstrap.git", |
| 49 | + "type": "git", |
| 50 | + "reference": "master" |
| 51 | + }, |
| 52 | + "dist": { |
| 53 | + "url": "https://github.com/twitter/bootstrap/zipball/master", |
| 54 | + "type": "zip" |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + ] |
| 59 | + } |
| 60 | + ``` |
| 61 | + |
| 62 | + 1.3. BootstrapBundle, twitters bootstrap and further suggests |
| 63 | + |
| 64 | + ```json |
| 65 | + { |
| 66 | + "require": { |
| 67 | + "mopa/bootstrap-bundle": "dev-master", |
| 68 | + "twitter/bootstrap": "master", |
| 69 | + "knplabs/knp-paginator-bundle": "dev-master", |
| 70 | + "knplabs/knp-menu-bundle": "dev-master", |
| 71 | + "craue/formflow-bundle": "dev-master" |
| 72 | + }, |
| 73 | + "repositories": [ |
| 74 | + { |
| 75 | + "type": "package", |
| 76 | + "package": { |
| 77 | + "version": "master", /* whatever version you want */ |
| 78 | + "name": "twitter/bootstrap", |
| 79 | + "source": { |
| 80 | + "url": "https://github.com/twitter/bootstrap.git", |
| 81 | + "type": "git", |
| 82 | + "reference": "master" |
| 83 | + }, |
| 84 | + "dist": { |
| 85 | + "url": "https://github.com/twitter/bootstrap/zipball/master", |
| 86 | + "type": "zip" |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + ] |
| 91 | + } |
| 92 | + ``` |
| 93 | + |
| 94 | + 1.4. BootstrapBundle, twitters bootstrap and automatic symlinking |
| 95 | + |
| 96 | + If you decided to let composer install twitters bootstrap, you might want to activate auto symlinking and checking, after composer update/install. |
| 97 | + So add this to your existing scripts section in your composer json: |
| 98 | + (recommended!) |
| 99 | + |
| 100 | + ```json |
| 101 | + { |
| 102 | + "scripts": { |
| 103 | + "post-install-cmd": [ |
| 104 | + "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap" |
| 105 | + ], |
| 106 | + "post-update-cmd": [ |
| 107 | + "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap" |
| 108 | + ] |
| 109 | + } |
| 110 | + } |
| 111 | + ``` |
| 112 | + |
| 113 | + There is also a console command to check and / or install this symlink: |
| 114 | + |
| 115 | + ```bash |
| 116 | + php app/console mopa:bootstrap:install |
| 117 | + ``` |
| 118 | + |
| 119 | + With these steps taken, bootstrap should be install into vendor/twitter/bootstrap/ and a symlink |
| 120 | + been created into vendor/mopa/bootstrap-bundle/Mopa/BootstrapBundle/Resources/bootstrap. |
| 121 | + |
| 122 | + 1.5. Include bootstrap manually or in another way: |
| 123 | + |
| 124 | + For including bootstrap there are different solutions, why using this one? |
| 125 | + have a look into [Including Bootstrap](https://github.com/phiamo/MopaBootstrapBundle/blob/master/Resources/doc/including-bootstrap.md) |
| 126 | + |
| 127 | +2. Add this bundle to your app/AppKernel.php: |
| 128 | + |
| 129 | + ``` php |
| 130 | + // application/ApplicationKernel.php |
| 131 | + public function registerBundles() |
| 132 | + { |
| 133 | + return array( |
| 134 | + // ... |
| 135 | + new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(), |
| 136 | + // ... |
| 137 | + ); |
| 138 | + } |
| 139 | + ``` |
| 140 | + |
| 141 | + 2.1. If you decided to add knp-menu-bundle, knp-paginator-bundle, or craue-formflow-bundle add them too: |
| 142 | + |
| 143 | + ``` php |
| 144 | + // application/ApplicationKernel.php |
| 145 | + public function registerBundles() |
| 146 | + { |
| 147 | + return array( |
| 148 | + // ... |
| 149 | + new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(), |
| 150 | + new Knp\Bundle\MenuBundle\KnpMenuBundle(), |
| 151 | + new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), |
| 152 | + new Craue\FormFlowBundle\CraueFormFlowBundle(), |
| 153 | + // ... |
| 154 | + ); |
| 155 | + } |
| 156 | + ``` |
| 157 | + |
| 158 | +3. If you like configure your config.yml (not mandatory) |
| 159 | + |
| 160 | + ``` yaml |
| 161 | + mopa_bootstrap: |
| 162 | + form: |
| 163 | + show_legend: false # default is true |
| 164 | + show_child_legend: false # default is true |
| 165 | + error_type: block # or inline which is default |
| 166 | + ``` |
| 167 | + |
0 commit comments