-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[3.0][Cookbook] Use the 3.0 directory structure #5917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bea4a0c
app/console -> bin/console
wouterj b6d93f0
app/phpunit.xml.dist -> phpunit.xml.dist
wouterj b3da3b7
app/cache -> var/cache
wouterj 6614c0f
app/logs -> var/logs
wouterj af7052b
app/bootstrap.php.cache -> var/bootstrap.php.cache
wouterj ef613f6
app/SymfonyRequirements.php -> bin/SymfonyRequirements.php
wouterj df20095
Testing changes
wouterj f2be12a
Updated directory structures
wouterj 47e11f8
Applied comments
wouterj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,16 @@ directory structure is: | |
|
||
your-project/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added |
||
├─ app/ | ||
│ ├─ cache/ | ||
│ ├─ config/ | ||
│ ├─ logs/ | ||
│ └─ ... | ||
├─ src/ | ||
│ └─ ... | ||
├─ tests/ | ||
│ └─ ... | ||
├─ var/ | ||
│ ├─ cache/ | ||
│ ├─ logs/ | ||
│ └─ ... | ||
├─ vendor/ | ||
│ └─ ... | ||
└─ web/ | ||
|
@@ -41,13 +45,13 @@ in the ``AppKernel`` class of you application:: | |
|
||
public function getCacheDir() | ||
{ | ||
return $this->rootDir.'/'.$this->environment.'/cache'; | ||
return dirname(__DIR__).'/var/'.$this->environment.'/cache'; | ||
} | ||
} | ||
|
||
``$this->rootDir`` is the absolute path to the ``app`` directory and ``$this->environment`` | ||
is the current environment (i.e. ``dev``). In this case you have changed | ||
the location of the cache directory to ``app/{environment}/cache``. | ||
In this code, ``$this->environment`` is the current environment (i.e. ``dev``). | ||
In this case you have changed the location of the cache directory to | ||
``var/{environment}/cache``. | ||
|
||
.. caution:: | ||
|
||
|
@@ -74,35 +78,34 @@ method:: | |
|
||
public function getLogDir() | ||
{ | ||
return $this->rootDir.'/'.$this->environment.'/logs'; | ||
return dirname(__DIR__).'/var/'.$this->environment.'/logs'; | ||
} | ||
} | ||
|
||
Here you have changed the location of the directory to ``app/{environment}/logs``. | ||
Here you have changed the location of the directory to ``var/{environment}/logs``. | ||
|
||
.. _override-web-dir: | ||
|
||
Override the ``web`` Directory | ||
------------------------------ | ||
|
||
If you need to rename or move your ``web`` directory, the only thing you | ||
need to guarantee is that the path to the ``app`` directory is still correct | ||
need to guarantee is that the path to the ``var`` directory is still correct | ||
in your ``app.php`` and ``app_dev.php`` front controllers. If you simply | ||
renamed the directory, you're fine. But if you moved it in some way, you | ||
may need to modify these paths inside those files:: | ||
|
||
require_once __DIR__.'/../Symfony/app/bootstrap.php.cache'; | ||
require_once __DIR__.'/../Symfony/app/AppKernel.php'; | ||
require_once __DIR__.'/../path/to/var/bootstrap.php.cache'; | ||
|
||
You also need to change the ``extra.symfony-web-dir`` option in the ``composer.json`` | ||
file: | ||
You also need to change the ``extra.symfony-web-dir`` option in the | ||
``composer.json`` file: | ||
|
||
.. code-block:: javascript | ||
.. code-block:: json | ||
|
||
{ | ||
... | ||
"...": "...", | ||
"extra": { | ||
... | ||
"...": "...", | ||
"symfony-web-dir": "my_new_web_dir" | ||
} | ||
} | ||
|
@@ -154,8 +157,8 @@ file: | |
|
||
.. code-block:: bash | ||
|
||
$ php app/console cache:clear --env=prod | ||
$ php app/console assetic:dump --env=prod --no-debug | ||
$ php bin/console cache:clear --env=prod | ||
$ php bin/console assetic:dump --env=prod --no-debug | ||
|
||
Override the ``vendor`` Directory | ||
--------------------------------- | ||
|
@@ -179,6 +182,7 @@ The change in the ``composer.json`` will look like this: | |
Then, update the path to the ``autoload.php`` file in ``app/autoload.php``:: | ||
|
||
// app/autoload.php | ||
|
||
// ... | ||
$loader = require '/some/dir/vendor/autoload.php'; | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't the
bin
directory present in here ? Is it expected ?It has nothing to do with configuration files, but same as for new
var
andtests
directories, right ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read through it: it's focusing on just the stuff in the
app/
directory. I think really we never neededsrc
,vendor
orweb
here.