Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89f4d25

Browse files
committed
feature#5917 [3.0][Cookbook] Use the 3.0 directory structure (WouterJ)
This PR was merged into the master branch.Discussion----------[3.0][Cookbook] Use the 3.0 directory structure| Q | A| --- | ---| Doc fix? | yes| New docs? | yes| Applies to | 3.0+| Fixed tickets | part of#5898Commits-------47e11f8 Applied commentsf2be12a Updated directory structuresdf20095 Testing changesef613f6 app/SymfonyRequirements.php -> bin/SymfonyRequirements.phpaf7052b app/bootstrap.php.cache -> var/bootstrap.php.cache6614c0f app/logs -> var/logsb3da3b7 app/cache -> var/cacheb6d93f0 app/phpunit.xml.dist -> phpunit.xml.distbea4a0c app/console -> bin/console
2 parents8236647 +47e11f8 commit89f4d25

34 files changed

+150
-138
lines changed

‎cookbook/assetic/asset_management.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ each time you deploy), you should run the following command:
500500

501501
..code-block::bash
502502
503-
$ phpapp/console assetic:dump --env=prod --no-debug
503+
$ phpbin/console assetic:dump --env=prod --no-debug
504504
505505
This will physically generate and write each file that you need (e.g. ``/js/abcd123.js``).
506506
If you update any of your assets, you'll need to run this again to regenerate
@@ -542,7 +542,7 @@ need to dump them manually. To do so, run the following command:
542542

543543
..code-block::bash
544544
545-
$ phpapp/console assetic:dump
545+
$ phpbin/console assetic:dump
546546
547547
This physically writes all of the asset files you need for your ``dev``
548548
environment. The big disadvantage is that you need to run this each time
@@ -551,7 +551,7 @@ assets will be regenerated automatically *as they change*:
551551

552552
..code-block::bash
553553
554-
$ phpapp/console assetic:watch
554+
$ phpbin/console assetic:watch
555555
556556
The ``assetic:watch`` command was introduced in AsseticBundle 2.4. In prior
557557
versions, you had to use the ``--watch`` option of the ``assetic:dump``

‎cookbook/bundles/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ via the ``config:dump-reference`` command:
108108

109109
..code-block::bash
110110
111-
$app/console config:dump-reference AsseticBundle
111+
$bin/console config:dump-reference AsseticBundle
112112
113113
Instead of the full bundle name, you can also pass the short name used as the root
114114
of the bundle's configuration:
115115

116116
..code-block::bash
117117
118-
$app/console config:dump-reference assetic
118+
$bin/console config:dump-reference assetic
119119
120120
The output will look like this:
121121

‎cookbook/configuration/apache_router.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Now generate the mod_rewrite rules:
9898

9999
..code-block::bash
100100
101-
$ phpapp/console router:dump-apache -e=prod --no-debug
101+
$ phpbin/console router:dump-apache -e=prod --no-debug
102102
103103
Which should roughly output the following:
104104

@@ -145,7 +145,7 @@ to ``ApacheRequest`` in ``web/app.php``::
145145

146146
// web/app.php
147147

148-
require_once __DIR__.'/../app/bootstrap.php.cache';
148+
require_once __DIR__.'/../var/bootstrap.php.cache';
149149
require_once __DIR__.'/../app/AppKernel.php';
150150
// require_once __DIR__.'/../app/AppCache.php';
151151

‎cookbook/configuration/configuration_organization.rst

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ default Symfony Standard Edition follow this structure:
3434

3535
..code-block::text
3636
37-
<your-project>/
37+
your-project/
3838
├─ app/
39+
│ ├─ ...
3940
│ └─ config/
4041
│ ├─ config.yml
4142
│ ├─ config_dev.yml
@@ -46,9 +47,7 @@ default Symfony Standard Edition follow this structure:
4647
│ ├─ routing.yml
4748
│ ├─ routing_dev.yml
4849
│ └─ security.yml
49-
├─ src/
50-
├─ vendor/
51-
└─ web/
50+
├─ ...
5251
5352
This default structure was chosen for its simplicity — one file per environment.
5453
But as any other Symfony feature, you can customize it to better suit your needs.
@@ -65,8 +64,9 @@ name as the environment:
6564

6665
..code-block::text
6766
68-
<your-project>/
67+
your-project/
6968
├─ app/
69+
│ ├─ ...
7070
│ └─ config/
7171
│ ├─ common/
7272
│ │ ├─ config.yml
@@ -83,9 +83,7 @@ name as the environment:
8383
│ ├─ parameters.yml
8484
│ ├─ routing.yml
8585
│ └─ security.yml
86-
├─ src/
87-
├─ vendor/
88-
└─ web/
86+
├─ ...
8987
9088
To make this work, change the code of the
9189
:method:`Symfony\\Component\\HttpKernel\\KernelInterface::registerContainerConfiguration`
@@ -161,8 +159,9 @@ and several files to define all application services:
161159

162160
..code-block::text
163161
164-
<your-project>/
162+
your-project/
165163
├─ app/
164+
│ ├─ ...
166165
│ └─ config/
167166
│ ├─ bundles/
168167
│ │ ├─ bundle1.yml
@@ -182,9 +181,7 @@ and several files to define all application services:
182181
│ ├─ backend.yml
183182
│ ├─ ...
184183
│ └─ security.yml
185-
├─ src/
186-
├─ vendor/
187-
└─ web/
184+
├─ ...
188185
189186
Again, change the code of the ``registerContainerConfiguration()`` method to
190187
make Symfony aware of the new file organization::

‎cookbook/configuration/environments.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ behavior:
221221
..code-block::bash
222222
223223
# 'dev' environment and debug enabled
224-
$ phpapp/console command_name
224+
$ phpbin/console command_name
225225
226226
# 'prod' environment (debug is always disabled for 'prod')
227-
$ phpapp/console command_name --env=prod
227+
$ phpbin/console command_name --env=prod
228228
229229
# 'test' environment and debug disabled
230-
$ phpapp/console command_name --env=test --no-debug
230+
$ phpbin/console command_name --env=test --no-debug
231231
232232
In addition to the ``--env`` and ``--debug`` options, the behavior of Symfony
233233
commands can also be controlled with environment variables. The Symfony console
@@ -342,13 +342,13 @@ Symfony takes advantage of caching in many ways: the application configuration,
342342
routing configuration, Twig templates and more are cached to PHP objects
343343
stored in files on the filesystem.
344344

345-
By default, these cached files are largely stored in the ``app/cache`` directory.
345+
By default, these cached files are largely stored in the ``var/cache`` directory.
346346
However, each environment caches its own set of files:
347347

348348
..code-block::text
349349
350-
<your-project>/
351-
├─app/
350+
your-project/
351+
├─var/
352352
│ ├─ cache/
353353
│ │ ├─ dev/ # cache directory for the *dev* environment
354354
│ │ └─ prod/ # cache directory for the *prod* environment
@@ -357,7 +357,7 @@ However, each environment caches its own set of files:
357357
Sometimes, when debugging, it may be helpful to inspect a cached file to
358358
understand how something is working. When doing so, remember to look in
359359
the directory of the environment you're using (most commonly ``dev`` while
360-
developing and debugging). While it can vary, the ``app/cache/dev`` directory
360+
developing and debugging). While it can vary, the ``var/cache/dev`` directory
361361
includes the following:
362362

363363
``appDevDebugProjectContainer.php``

‎cookbook/configuration/front_controllers_and_kernel.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ as the default one.
7575
access. For example, you don't want to make a debugging environment
7676
available to arbitrary users in your production environment.
7777

78-
Technically, the `app/console`_ script used when running Symfony on the command
78+
Technically, the `bin/console`_ script used when running Symfony on the command
7979
line is also a front controller, only that is not used for web, but for command
8080
line requests.
8181

@@ -162,7 +162,7 @@ way of loading your configuration.
162162
.. _Symfony Standard Edition:https://github.com/symfony/symfony-standard
163163
.. _app.php:https://github.com/symfony/symfony-standard/blob/master/web/app.php
164164
.. _app_dev.php:https://github.com/symfony/symfony-standard/blob/master/web/app_dev.php
165-
.._app/console:https://github.com/symfony/symfony-standard/blob/master/app/console
165+
.._bin/console:https://github.com/symfony/symfony-standard/blob/master/bin/console
166166
.. _AppKernel:https://github.com/symfony/symfony-standard/blob/master/app/AppKernel.php
167167
.. _decorate:https://en.wikipedia.org/wiki/Decorator_pattern
168168
.. _RewriteRule shipped with the Symfony Standard Edition:https://github.com/symfony/symfony-standard/blob/master/web/.htaccess

‎cookbook/configuration/override_dir_structure.rst

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ directory structure is:
1212
1313
your-project/
1414
├─ app/
15-
│ ├─ cache/
1615
│ ├─ config/
17-
│ ├─ logs/
1816
│ └─ ...
1917
├─ src/
2018
│ └─ ...
19+
├─ tests/
20+
│ └─ ...
21+
├─ var/
22+
│ ├─ cache/
23+
│ ├─ logs/
24+
│ └─ ...
2125
├─ vendor/
2226
│ └─ ...
2327
└─ web/
@@ -41,13 +45,13 @@ in the ``AppKernel`` class of you application::
4145

4246
public function getCacheDir()
4347
{
44-
return$this->rootDir.'/'.$this->environment.'/cache';
48+
returndirname(__DIR__).'/var/'.$this->environment.'/cache';
4549
}
4650
}
4751

48-
``$this->rootDir`` is theabsolute path to the ``app`` directory and ``$this->environment``
49-
is the current environment (i.e. ``dev``).In this case you have changed
50-
the location of the cache directory to ``app/{environment}/cache``.
52+
In this code,``$this->environment`` is thecurrent environment (i.e. ``dev``).
53+
In this case you have changed the location of the cache directory to
54+
``var/{environment}/cache``.
5155

5256
..caution::
5357

@@ -74,35 +78,34 @@ method::
7478

7579
public function getLogDir()
7680
{
77-
return$this->rootDir.'/'.$this->environment.'/logs';
81+
returndirname(__DIR__).'/var/'.$this->environment.'/logs';
7882
}
7983
}
8084

81-
Here you have changed the location of the directory to ``app/{environment}/logs``.
85+
Here you have changed the location of the directory to ``var/{environment}/logs``.
8286

8387
.. _override-web-dir:
8488

8589
Override the ``web`` Directory
8690
------------------------------
8791

8892
If you need to rename or move your ``web`` directory, the only thing you
89-
need to guarantee is that the path to the ``app`` directory is still correct
93+
need to guarantee is that the path to the ``var`` directory is still correct
9094
in your ``app.php`` and ``app_dev.php`` front controllers. If you simply
9195
renamed the directory, you're fine. But if you moved it in some way, you
9296
may need to modify these paths inside those files::
9397

94-
require_once __DIR__.'/../Symfony/app/bootstrap.php.cache';
95-
require_once __DIR__.'/../Symfony/app/AppKernel.php';
98+
require_once __DIR__.'/../path/to/var/bootstrap.php.cache';
9699

97-
You also need to change the ``extra.symfony-web-dir`` option in the ``composer.json``
98-
file:
100+
You also need to change the ``extra.symfony-web-dir`` option in the
101+
``composer.json``file:
99102

100-
..code-block::javascript
103+
..code-block::json
101104
102105
{
103-
...
106+
"...":"...",
104107
"extra": {
105-
...
108+
"...":"...",
106109
"symfony-web-dir":"my_new_web_dir"
107110
}
108111
}
@@ -154,8 +157,8 @@ file:
154157

155158
..code-block::bash
156159
157-
$ phpapp/console cache:clear --env=prod
158-
$ phpapp/console assetic:dump --env=prod --no-debug
160+
$ phpbin/console cache:clear --env=prod
161+
$ phpbin/console assetic:dump --env=prod --no-debug
159162
160163
Override the ``vendor`` Directory
161164
---------------------------------
@@ -179,6 +182,7 @@ The change in the ``composer.json`` will look like this:
179182
Then, update the path to the ``autoload.php`` file in ``app/autoload.php``::
180183

181184
// app/autoload.php
185+
182186
// ...
183187
$loader = require '/some/dir/vendor/autoload.php';
184188

‎cookbook/console/console_command.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ This command will now automatically be available to run:
6868

6969
..code-block::bash
7070
71-
$ phpapp/console demo:greet Fabien
71+
$ phpbin/console demo:greet Fabien
7272
7373
.. _cookbook-console-dic:
7474

‎cookbook/console/logging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ container and use it to do the logging::
6565
}
6666

6767
Depending on the environment in which you run your command (and your logging
68-
setup), you should see the logged entries in ``app/logs/dev.log`` or ``app/logs/prod.log``.
68+
setup), you should see the logged entries in ``var/logs/dev.log`` or ``var/logs/prod.log``.
6969

7070
Enabling automatic Exceptions Logging
7171
-------------------------------------

‎cookbook/console/usage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ clear and warm the ``prod`` cache you need to run:
1717

1818
..code-block::bash
1919
20-
$ phpapp/console cache:clear --env=prod
20+
$ phpbin/console cache:clear --env=prod
2121
2222
or the equivalent:
2323

2424
..code-block::bash
2525
26-
$ phpapp/console cache:clear -e prod
26+
$ phpbin/console cache:clear -e prod
2727
2828
In addition to changing the environment, you can also choose to disable debug mode.
2929
This can be useful where you want to run commands in the ``dev`` environment
3030
but avoid the performance hit of collecting debug data:
3131

3232
..code-block::bash
3333
34-
$ phpapp/console list --no-debug
34+
$ phpbin/console list --no-debug

‎cookbook/debugging.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,21 @@ The ``app_dev.php`` front controller reads as follows by default::
3030

3131
// ...
3232

33-
$loader =require_once __DIR__.'/../app/bootstrap.php.cache';
34-
require_once __DIR__.'/../app/AppKernel.php';
33+
$loader =require __DIR__.'/../app/autoload.php';
34+
Debug::enable();
3535

3636
$kernel = new AppKernel('dev', true);
3737
$kernel->loadClassCache();
3838
$request = Request::createFromGlobals();
39+
// ...
3940

40-
To make your debugger happier, disable all PHP class caches by removing the
41-
call to ``loadClassCache()`` and by replacing the require statements like
42-
below::
41+
To make your debugger happier, disable all PHP class caches by removing (or
42+
commenting) the call to ``loadClassCache()``::
4343

4444
// ...
4545

46-
// $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
4746
$loader = require_once __DIR__.'/../app/autoload.php';
48-
require_once __DIR__.'/../app/AppKernel.php';
47+
Debug::enable();
4948

5049
$kernel = new AppKernel('dev', true);
5150
// $kernel->loadClassCache();

‎cookbook/deployment/azure-website.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,12 @@ directory with at least the following contents:
260260
..code-block::text
261261
262262
/app/bootstrap.php.cache
263-
/app/cache/*
263+
/var/cache/*
264264
/app/config/parameters.yml
265-
/app/logs/*
266-
!app/cache/.gitkeep
267-
!app/logs/.gitkeep
268-
/app/SymfonyRequirements.php
265+
/var/logs/*
266+
!var/cache/.gitkeep
267+
!var/logs/.gitkeep
268+
/var/SymfonyRequirements.php
269269
/build/
270270
/vendor/
271271
/bin/
@@ -388,7 +388,7 @@ MySQL database.
388388

389389
..code-block::bash
390390
391-
$ phpapp/console doctrine:schema:update --force
391+
$ phpbin/console doctrine:schema:update --force
392392
393393
This command builds the tables and indexes for your MySQL database. If your
394394
Symfony application is more complex than a basic Symfony Standard Edition, you

‎cookbook/deployment/heroku.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ This is also very useful to build assets on the production system, e.g. with Ass
275275
{
276276
"scripts": {
277277
"compile": [
278-
"app/console assetic:dump"
278+
"bin/console assetic:dump"
279279
]
280280
}
281281
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp