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

Appearance settings

Commit 9c802b3

Browse filesBrowse files
author
Joe Bennett
committed
Merge branch 'master' into 27345-lock-mongodb
2 parents 2f48e8a + f3d7488 commit 9c802b3
Copy full SHA for 9c802b3

File tree

552 files changed

+17693
-14527
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

552 files changed

+17693
-14527
lines changed

‎.platform/routes.yaml

Copy file name to clipboardExpand all lines: .platform/routes.yaml
-16Lines changed: 0 additions & 16 deletions
This file was deleted.

‎.platform.app.yaml renamed to ‎.symfony.cloud.yaml

Copy file name to clipboardExpand all lines: .symfony.cloud.yaml
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
name: symfonydocs
66

77
# The toolstack used to build the application.
8-
type: "php"
9-
10-
build:
11-
flavor: "composer"
8+
type: "python:3.7"
129

1310
# The configuration of app when it is exposed to the web.
1411
web:
@@ -53,7 +50,7 @@ hooks:
5350
build: |
5451
virtualenv .virtualenv
5552
. .virtualenv/bin/activate
56-
# Platform.sh currently sets PIP_USER=1.
53+
# SymfonyCloud currently sets PIP_USER=1.
5754
export PIP_USER=
5855
pip install pip==9.0.1 wheel==0.29.0
5956
pip install -r _build/.requirements.txt

‎.symfony/routes.yaml

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
https://{default}/:
2+
cache:
3+
cookies:
4+
- '*'
5+
default_ttl: 0
6+
enabled: true
7+
headers:
8+
- Accept
9+
- Accept-Language
10+
type: upstream
11+
upstream: symfonydocs:http
File renamed without changes.

‎Dockerfile

Copy file name to clipboard
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM python:2-stretch as builder
2+
3+
WORKDIR /www
4+
5+
COPY ./_build/.requirements.txt _build/
6+
7+
RUN pip install pip==9.0.1 wheel==0.29.0 \
8+
&& pip install -r _build/.requirements.txt
9+
10+
COPY . /www
11+
12+
RUN make -C _build html
13+
14+
FROM nginx:latest
15+
16+
COPY --from=builder /www/_build/html /usr/share/nginx/html

‎README.markdown

Copy file name to clipboardExpand all lines: README.markdown
+22-5Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,32 @@ Contributing
77
------------
88

99
>**Note**
10-
>Unless you're documenting a feature that was introduced *after* Symfony 2.8
11-
>(e.g. in Symfony 3.4), all pull requests must be based off of the **2.8** branch,
10+
>Unless you're documenting a feature that was introduced *after* Symfony 3.4
11+
>(e.g. in Symfony 4.2), all pull requests must be based off of the **3.4** branch,
1212
>**not** the master or older branches.
1313
1414
We love contributors! For more information on how you can contribute to the
1515
Symfony documentation, please read
1616
[Contributing to the Documentation](https://symfony.com/doc/current/contributing/documentation/overview.html)
1717

18-
Platform.sh
19-
-----------
18+
SymfonyCloud
19+
------------
20+
21+
Pull requests are automatically built by [SymfonyCloud](https://symfony.com/cloud).
22+
23+
Docker
24+
------
25+
26+
You can build the doc locally with these commands:
27+
28+
```bash
29+
# build the image...
30+
$ docker build . -t symfony-docs
31+
32+
# ...and start the local web server
33+
# (if it's already in use, change the '8080' port by any other port)
34+
$ docker run --rm -p 8080:80 symfony-docs
35+
```
2036

21-
Pull requests are automatically built by [Platform.sh](https://platform.sh).
37+
You can now read the docs at http://127.0.0.1:8080 (if you use a virtual
38+
machine, browse its IP instead of localhost; e.g. `http://192.168.99.100:8080`).

‎_build/.requirements.txt

Copy file name to clipboardExpand all lines: _build/.requirements.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Jinja2==2.9.6
66
MarkupSafe==1.0
77
Pygments==2.2.0
88
pytz==2017.2
9-
requests==2.12.5
9+
requests==2.20.0
1010
six==1.10.0
1111
snowballstemmer==1.2.1
1212
Sphinx==1.3.6

‎_build/redirection_map

Copy file name to clipboardExpand all lines: _build/redirection_map
+24-1Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
/cookbook/console/commands_as_services /console/commands_as_services
120120
/cookbook/console/console_command /console
121121
/cookbook/console/index /console
122-
/cookbook/console/logging /console/logging
122+
/cookbook/console/logging /console
123123
/cookbook/console/request_context /console/request_context
124124
/cookbook/console/style /console/style
125125
/cookbook/console/usage /console
@@ -390,3 +390,26 @@
390390
/quick_tour/the_view /quick_tour/flex_recipes
391391
/service_container/service_locators /service_container/service_subscribers_locators
392392
/templating/overriding /bundles/override
393+
/security/custom_provider /security/user_provider
394+
/security/multiple_user_providers /security/user_provider
395+
/security/custom_password_authenticator /security/guard_authentication
396+
/security/api_key_authentication /security/guard_authentication
397+
/security/pre_authenticated /security/auth_providers
398+
/security/host_restriction /security/firewall_restriction
399+
/security/acl_advanced /security/acl
400+
/security/password_encoding /security
401+
/weblink /web_link
402+
/components/weblink /components/web_link
403+
/frontend/encore/installation-no-flex /frontend/encore/installation
404+
/http_cache/form_csrf_caching /security/csrf
405+
/console/logging /console
406+
/reference/forms/twig_reference /form/form_customization
407+
/form/rendering /form/form_customization
408+
/profiler/matchers /profiler
409+
/profiler/profiling_data /profiler
410+
/profiler/wdt_follow_ajax /profiler
411+
/security/entity_provider /security/user_provider
412+
/session/avoid_session_start /session
413+
/session/sessions_directory /session
414+
/frontend/encore/legacy-apps /frontend/encore/legacy-applications
415+
/configuration/external_parameters /configuration/environment_variables
-21.9 KB
Binary file not shown.

‎_images/components/messenger/overview.svg

Copy file name to clipboardExpand all lines: _images/components/messenger/overview.svg
+1Lines changed: 1 addition & 0 deletions
Loading
Binary file not shown.

‎_images/components/serializer/serializer_workflow.svg

Copy file name to clipboardExpand all lines: _images/components/serializer/serializer_workflow.svg
+1Lines changed: 1 addition & 0 deletions
Loading
-20.7 KB
Loading
Binary file not shown.
Loading

‎_images/form/form-field-parts.svg

Copy file name to clipboardExpand all lines: _images/form/form-field-parts.svg
+1Lines changed: 1 addition & 0 deletions
Loading

‎_images/http/request-flow.png

Copy file name to clipboard
-75.3 KB
Binary file not shown.

‎_images/http/request-flow.svg

Copy file name to clipboardExpand all lines: _images/http/request-flow.svg
+1Lines changed: 1 addition & 0 deletions
Loading

‎_images/mercure/chrome.png

Copy file name to clipboard
158 KB
Loading

‎_images/mercure/discovery.png

Copy file name to clipboard
173 KB
Loading

‎_images/mercure/schema.png

Copy file name to clipboard
326 KB
Loading

‎_images/profiler/web-interface.png

Copy file name to clipboard
73.9 KB
Loading

‎_images/security/authentication-guard-methods.svg

Copy file name to clipboardExpand all lines: _images/security/authentication-guard-methods.svg
+1-1Lines changed: 1 addition & 1 deletion
Loading

‎_images/security/http_basic_popup.png

Copy file name to clipboard
-38.6 KB
Binary file not shown.
61 KB
Loading
Binary file not shown.
Binary file not shown.
2 KB
Binary file not shown.

‎_images/sources/http/request-flow.dia

Copy file name to clipboard
2.93 KB
Binary file not shown.
Binary file not shown.

‎_includes/service_container/_my_mailer.rst.inc

Copy file name to clipboardExpand all lines: _includes/service_container/_my_mailer.rst.inc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<container xmlns="http://symfony.com/schema/dic/services"
1616
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1717
xsi:schemaLocation="http://symfony.com/schema/dic/services
18-
http://symfony.com/schema/dic/services/services-1.0.xsd">
18+
https://symfony.com/schema/dic/services/services-1.0.xsd">
1919

2020
<services>
2121
<service id="app.mailer" class="App\Mailer">

‎best_practices/business-logic.rst

Copy file name to clipboardExpand all lines: best_practices/business-logic.rst
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ post URL. Let's create a new ``Slugger`` class inside ``src/Utils/``::
5757
}
5858

5959
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`,
60-
this class is auto-registered as a service whose ID is ``App\Utils\Slugger`` (or
61-
simply ``Slugger::class`` if the class is already imported in your code).
60+
this class is auto-registered as a service with the ID ``App\Utils\Slugger`` (to
61+
prevent against typos, import the class and write ``Slugger::class`` in your code).
6262

6363
.. best-practice::
6464

@@ -110,7 +110,7 @@ Both formats have the same performance, so this is ultimately a matter of
110110
personal taste.
111111

112112
We recommend YAML because it's friendly to newcomers and concise. You can
113-
of course use whatever format you like.
113+
use any of the other formats if you prefer another format.
114114

115115
Using a Persistence Layer
116116
-------------------------
@@ -198,7 +198,7 @@ looking for mapping information::
198198

199199
/**
200200
* @ORM\OneToMany(
201-
* targetEntity="Comment",
201+
* targetEntity="App\Entity\Comment",
202202
* mappedBy="post",
203203
* orphanRemoval=true
204204
* )
@@ -232,7 +232,6 @@ Then, this bundle is enabled automatically, but only for the ``dev`` and
232232
``test`` environments::
233233

234234
// config/bundles.php
235-
236235
return [
237236
// ...
238237
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],

‎best_practices/configuration.rst

Copy file name to clipboardExpand all lines: best_practices/configuration.rst
+18-14Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ and security credentials) and different environments (development, production).
66
That's why Symfony recommends that you split the application configuration into
77
three parts.
88

9-
.. _config-parameters.yml:
10-
119
Infrastructure-Related Configuration
1210
------------------------------------
1311

@@ -18,8 +16,9 @@ application behavior.
1816
.. best-practice::
1917

2018
Define the infrastructure-related configuration options as
21-
:doc:`environment variables </configuration/external_parameters>`. During
22-
development, use the ``.env`` file at the root of your project to set these.
19+
:doc:`environment variables </configuration/environment_variables>`. During
20+
development, use the ``.env`` and ``.env.local`` files at the root of your
21+
project to set these.
2322

2423
By default, Symfony adds these types of options to the ``.env`` file when
2524
installing new dependencies in the app:
@@ -42,28 +41,33 @@ they have nothing to do with the application's behavior. In other words, your
4241
application doesn't care about the location of your database or the credentials
4342
to access to it, as long as the database is correctly configured.
4443

44+
To override these variables with machine-specific or sensitive values, create a
45+
``.env.local`` file. This file should not be added to version control.
46+
4547
.. caution::
4648

4749
Beware that dumping the contents of the ``$_SERVER`` and ``$_ENV`` variables
4850
or outputting the ``phpinfo()`` contents will display the values of the
4951
environment variables, exposing sensitive information such as the database
5052
credentials.
5153

52-
.. _best-practices-canonical-parameters:
53-
5454
Canonical Parameters
5555
~~~~~~~~~~~~~~~~~~~~
5656

5757
.. best-practice::
5858

59-
Define all your application's env vars in the ``.env.dist`` file.
59+
Define all your application's env vars in the ``.env`` file.
6060

61-
Symfony includes a configuration file called ``.env.dist`` at the project root,
62-
which stores the canonical list of environment variables for the application.
61+
Symfony includes a configuration file called ``.env`` at the project root, which
62+
stores the canonical list of environment variables for the application. This
63+
file should be stored in version control and so should only contain non-sensitive
64+
default values.
65+
66+
.. caution::
6367

64-
Whenever a new env var is defined for the application, you should also add it to
65-
this file and submit the changes to your version control system so your
66-
workmates can update their ``.env`` files.
68+
Applications created before November 2018 had a slightly different system,
69+
involving a ``.env.dist`` file. For information about upgrading, see:
70+
:doc:`/configuration/dot-env-changes`.
6771

6872
Application-Related Configuration
6973
---------------------------------
@@ -96,8 +100,8 @@ paginated results.
96100
Use constants to define configuration options that rarely change.
97101

98102
The traditional approach for defining configuration options has caused many
99-
Symfony apps to include an option like the following, which would be used
100-
to control the number of posts to display on the blog homepage:
103+
Symfony applications to include an option like the following, which would be
104+
used to control the number of posts to display on the blog homepage:
101105

102106
.. code-block:: yaml
103107

‎best_practices/controllers.rst

Copy file name to clipboardExpand all lines: best_practices/controllers.rst
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Fetching Services
128128

129129
If you extend the base ``AbstractController`` class, you can't access services
130130
directly from the container via ``$this->container->get()`` or ``$this->get()``.
131-
Instead, you must use dependency injection to fetch services: most easily done by
131+
Instead, you must use dependency injection to fetch services by
132132
:ref:`type-hinting action method arguments <controller-accessing-services>`:
133133

134134
.. best-practice::
@@ -181,7 +181,7 @@ When Things Get More Advanced
181181

182182
The above example works without any configuration because the wildcard name
183183
``{id}`` matches the name of the property on the entity. If this isn't true, or
184-
if you have even more complex logic, the easiest thing to do is just query for
184+
if you have even more complex logic, your best choice is to query for
185185
the entity manually. In our application, we have this situation in
186186
``CommentController``::
187187

@@ -218,9 +218,9 @@ flexible::
218218
// ...
219219
}
220220

221-
The point is this: the ParamConverter shortcut is great for simple situations.
222-
But you shouldn't forget that querying for entities directly is still very
223-
easy.
221+
The point is this: the ParamConverter shortcut is great for most situations.
222+
However, there is nothing wrong with querying for entities directly if the
223+
ParamConverter would get complicated.
224224

225225
Pre and Post Hooks
226226
------------------

‎best_practices/creating-the-project.rst

Copy file name to clipboardExpand all lines: best_practices/creating-the-project.rst
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ Structuring the Application
4848
---------------------------
4949

5050
After creating the application, enter the ``blog/`` directory and you'll see a
51-
number of files and directories generated automatically:
51+
number of files and directories generated automatically. These are the most
52+
important ones:
5253

5354
.. code-block:: text
5455
@@ -75,13 +76,13 @@ Application Bundles
7576

7677
When Symfony 2.0 was released, most developers naturally adopted the symfony
7778
1.x way of dividing applications into logical modules. That's why many Symfony
78-
apps used bundles to divide their code into logical features: UserBundle,
79+
applications used bundles to divide their code into logical features: UserBundle,
7980
ProductBundle, InvoiceBundle, etc.
8081

8182
But a bundle is *meant* to be something that can be reused as a stand-alone
8283
piece of software. If UserBundle cannot be used *"as is"* in other Symfony
83-
apps, then it shouldn't be its own bundle. Moreover, if InvoiceBundle depends on
84-
ProductBundle, then there's no advantage to having two separate bundles.
84+
applications, then it shouldn't be its own bundle. Moreover, if InvoiceBundle
85+
depends on ProductBundle, then there's no advantage to having two separate bundles.
8586

8687
.. best-practice::
8788

‎best_practices/forms.rst

Copy file name to clipboardExpand all lines: best_practices/forms.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ view layer:
134134
{{ form_start(form) }}
135135
{{ form_widget(form) }}
136136

137-
<input type="submit" class="btn" value="Create" />
137+
<input type="submit" class="btn" value="Create"/>
138138
{{ form_end(form) }}
139139

140140
Validation
@@ -161,7 +161,7 @@ blank, add the following in the ``Post`` object::
161161
class Post
162162
{
163163
/**
164-
* @Assert\NotBlank()
164+
* @Assert\NotBlank
165165
*/
166166
public $title;
167167
}

‎best_practices/introduction.rst

Copy file name to clipboardExpand all lines: best_practices/introduction.rst
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ What is this Guide About?
1919
-------------------------
2020

2121
This guide aims to fix that by describing the **best practices for developing
22-
web apps with the Symfony full-stack Framework**. These are best practices that
23-
fit the philosophy of the framework as envisioned by its original creator
22+
web applications with the Symfony full-stack Framework**. These are best practices
23+
that fit the philosophy of the framework as envisioned by its original creator
2424
`Fabien Potencier`_.
2525

2626
.. note::
@@ -44,13 +44,13 @@ then **extend and fit to your specific needs**:
4444

4545
We know that old habits die hard and some of you will be shocked by some
4646
of these best practices. But by following these, you'll be able to develop
47-
apps faster, with less complexity and with the same or even higher quality.
48-
It's also a moving target that will continue to improve.
47+
applications faster, with less complexity and with the same or even higher
48+
quality. It's also a moving target that will continue to improve.
4949

5050
Keep in mind that these are **optional recommendations** that you and your
5151
team may or may not follow to develop Symfony applications. If you want to
52-
continue using your own best practices and methodologies, you can of course
53-
do it. Symfony is flexible enough to adapt to your needs. That will never
52+
continue using your own best practices and methodologies, you can still do
53+
that. Symfony is flexible enough to adapt to your needs. That will never
5454
change.
5555

5656
Who this Book Is for (Hint: It's not a Tutorial)
@@ -102,5 +102,5 @@ for not doing it are various:
102102

103103
Next: :doc:`/best_practices/creating-the-project`
104104

105-
.. _`Fabien Potencier`: https://connect.sensiolabs.com/profile/fabpot
105+
.. _`Fabien Potencier`: https://connect.symfony.com/profile/fabpot
106106
.. _`Symfony Demo`: https://github.com/symfony/demo

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.