Skip to content

Commit 5594531

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: Rewrite utf8mb4 cautions, add comment into sample configuration Add backticks for code-styling Indenting caution block to nest it inside the sidebar Revert "Fix example name to avoid breaking collision with standard data-collectors" Revert "Add a cautionary note telling users where the "standard" data-collector names can be found." Add a cautionary note telling users where the "standard" data-collector names can be found. Fix example name to avoid breaking collision with standard data-collectors Change MySQL UTF-8 examples to use utf8mb4, which is closer to the standard most people would expect [Cookbook] Custom compile steps on Heroku Added information about the Symfony Demo application
2 parents f3bf826 + 4788a50 commit 5594531

File tree

3 files changed

+110
-10
lines changed

3 files changed

+110
-10
lines changed

best_practices/introduction.rst

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,23 @@ what you already know.
6969
The Application
7070
---------------
7171

72-
In addition to this guide, you'll find a sample application developed with
73-
all these best practices in mind. **The application is a simple blog engine**,
74-
because that will allow us to focus on the Symfony concepts and features without
75-
getting buried in difficult details.
72+
In addition to this guide, a sample application has been developed with all these
73+
best practices in mind. This project, called the Symfony Demo application, can
74+
be obtained through the Symfony Installer. First, `download and install`_ the
75+
installer and then execute this command to download the demo application:
7676

77-
Instead of developing the application step by step in this guide, you'll find
78-
selected snippets of code through the chapters. Please refer to the last chapter
79-
of this guide to find more details about this application and the instructions
80-
to install it.
77+
.. code-block:: bash
78+
79+
# Linux and Mac OS X
80+
$ symfony demo
81+
82+
# Windows
83+
c:\> php symfony demo
84+
85+
**The demo application is a simple blog engine**, because that will allow us to
86+
focus on the Symfony concepts and features without getting buried in difficult
87+
implementation details. Instead of developing the application step by step in
88+
this guide, you'll find selected snippets of code through the chapters.
8189

8290
Don't Update Your Existing Applications
8391
---------------------------------------
@@ -95,3 +103,4 @@ practices**. The reasons for not doing it are various:
95103
your tests or adding features that provide real value to the end users.
96104

97105
.. _`Fabien Potencier`: https://connect.sensiolabs.com/profile/fabpot
106+
.. _`download and install`: http://symfony.com/download

book/doctrine.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,13 @@ for you:
141141
.. code-block:: ini
142142
143143
[mysqld]
144-
collation-server = utf8_general_ci
145-
character-set-server = utf8
144+
# Version 5.5.3 introduced "utf8mb4", which is recommended
145+
collation-server = utf8mb4_general_ci # Replaces utf8_general_ci
146+
character-set-server = utf8mb4 # Replaces utf8
147+
148+
We recommend against MySQL's ``utf8`` character set, since it does not
149+
support 4-byte unicode characters, and strings containing them will be
150+
truncated. This is fixed by the `newer utf8mb4 character set`_.
146151

147152
.. note::
148153

@@ -1422,3 +1427,4 @@ For more information about Doctrine, see the *Doctrine* section of the
14221427
.. _`migrations`: http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html
14231428
.. _`DoctrineFixturesBundle`: http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html
14241429
.. _`FrameworkExtraBundle documentation`: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
1430+
.. _`newer utf8mb4 character set`: https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html

cookbook/deployment/heroku.rst

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,85 @@ You should be seeing your Symfony application in your browser.
235235
AcmeDemoBundle is only loaded in the dev environment (check out your
236236
``AppKernel`` class). Try opening ``/app/example`` from the AppBundle.
237237

238+
Custom Compile Steps
239+
~~~~~~~~~~~~~~~~~~~~
240+
241+
If you wish to execute additional custom commands during a build, you can leverage
242+
Heroku's `custom compile steps`_. Imagine you want to remove the ``dev`` front controller
243+
from your production environment on Heroku in order to avoid a potential vulnerability.
244+
Adding a command to remove ``web/app_dev.php`` to Composer's `post-install-commands`_ would
245+
work, but it also removes the controller in your local development environment on each
246+
``composer install`` or ``composer update`` respectively. Instead, you can add a
247+
`custom Composer command`_ named ``compile`` (this key name is a Heroku convention) to the
248+
``scripts`` section of your ``composer.json``. The listed commands hook into Heroku's deploy
249+
process:
250+
251+
.. code-block:: json
252+
253+
{
254+
"scripts": {
255+
"compile": [
256+
"rm web/app_dev.php"
257+
]
258+
}
259+
}
260+
261+
This is also very useful to build assets on the production system, e.g. with Assetic:
262+
263+
.. code-block:: json
264+
265+
{
266+
"scripts": {
267+
"compile": [
268+
"app/console assetic:dump"
269+
]
270+
}
271+
}
272+
273+
.. sidebar:: Node.js Dependencies
274+
275+
Building assets may depend on node packages, e.g. ``uglifyjs`` or ``uglifycss``
276+
for asset minification. Installing node packages during the deploy requires a node
277+
installation. But currently, Heroku compiles your app using the PHP buildpack, which
278+
is auto-detected by the presence of a ``composer.json`` file, and does not include a
279+
node installation. Because the Node.js buildpack has a higher precedence than the PHP
280+
buildpack (see `Heroku buildpacks`_), adding a ``package.json`` listing your node
281+
dependencies makes Heroku opt for the Node.js buildpack instead:
282+
283+
.. code-block:: json
284+
285+
{
286+
"name": "myApp",
287+
"engines": {
288+
"node": "0.12.x"
289+
},
290+
"dependencies": {
291+
"uglifycss": "*",
292+
"uglify-js": "*"
293+
}
294+
}
295+
296+
With the next deploy, Heroku compiles your app using the Node.js buildpack and
297+
your npm packages become installed. On the other hand, your ``composer.json`` is
298+
now ignored. To compile your app with both buildpacks, Node.js *and* PHP, you can
299+
use a special `multiple buildpack`_. To override buildpack auto-detection, you
300+
need to explicitly set the buildpack URL:
301+
302+
.. code-block:: bash
303+
304+
$ heroku buildpack:set https://github.com/ddollar/heroku-buildpack-multi.git
305+
306+
Next, add a ``.buildpacks`` file to your project, listing the buildpacks you need:
307+
308+
.. code-block:: text
309+
310+
https://github.com/heroku/heroku-buildpack-nodejs.git
311+
https://github.com/heroku/heroku-buildpack-php.git
312+
313+
With the next deploy, you can benefit from both buildpacks. This setup also enables
314+
your Heroku environment to make use of node based automatic build tools like
315+
`Grunt`_ or `gulp`_.
316+
238317
.. _`the original article`: https://devcenter.heroku.com/articles/getting-started-with-symfony2
239318
.. _`signup with Heroku`: https://signup.heroku.com/signup/dc
240319
.. _`Heroku Toolbelt`: https://devcenter.heroku.com/articles/getting-started-with-php#local-workstation-setup
@@ -244,3 +323,9 @@ You should be seeing your Symfony application in your browser.
244323
.. _`verified that the RSA key fingerprint is correct`: https://devcenter.heroku.com/articles/git-repository-ssh-fingerprints
245324
.. _`post-install-commands`: https://getcomposer.org/doc/articles/scripts.md
246325
.. _`config vars`: https://devcenter.heroku.com/articles/config-vars
326+
.. _`custom compile steps`: https://devcenter.heroku.com/articles/php-support#custom-compile-step
327+
.. _`custom Composer command`: https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands
328+
.. _`Heroku buildpacks`: https://devcenter.heroku.com/articles/buildpacks
329+
.. _`multiple buildpack`: https://github.com/ddollar/heroku-buildpack-multi.git
330+
.. _`Grunt`: http://gruntjs.com
331+
.. _`gulp`: http://gulpjs.com

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy