Skip to content

Commit 7fa7110

Browse files
committed
minor #7118 Minor changes throughout Best Practices for Reusable Bundles (darrylhein, javiereguiluz, HeahDude)
This PR was submitted for the 3.1 branch but it was merged into the 2.7 branch instead (closes #7118). Discussion ---------- Minor changes throughout Best Practices for Reusable Bundles Cleanup and fixes for parts that were difficult to understand Commits ------- c3bd3e6 Update best_practices.rst 5b8698c Better explain the purpose of the "license" Composer metadata 2da0fd8 Reverted the changes about bundle namespaces 7055d6b Removed backticks from bundle names 57fcec0 add mention of symfony.com re folder structure 0ed9c2d reword the documentation section re Resources/doc 4a0632d Reverting previous grammar change 527e16a Removing trailing space fe7795f Minor changes throughout BP for Reusable Bundles
2 parents 8af4575 + c3bd3e6 commit 7fa7110

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

bundles/best_practices.rst

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Bundle Name
3131
A bundle is also a PHP namespace. The namespace must follow the `PSR-0`_ or
3232
`PSR-4`_ interoperability standards for PHP namespaces and class names: it starts
3333
with a vendor segment, followed by zero or more category segments, and it ends
34-
with the namespace short name, which must end with a ``Bundle`` suffix.
34+
with the namespace short name, which must end with ``Bundle``.
3535

3636
A namespace becomes a bundle as soon as you add a bundle class to it. The
3737
bundle class name must follow these simple rules:
@@ -48,8 +48,8 @@ Here are some valid bundle namespaces and class names:
4848
========================== ==================
4949
Namespace Bundle Class Name
5050
========================== ==================
51-
``Acme\Bundle\BlogBundle`` ``AcmeBlogBundle``
52-
``Acme\BlogBundle`` ``AcmeBlogBundle``
51+
``Acme\Bundle\BlogBundle`` AcmeBlogBundle
52+
``Acme\BlogBundle`` AcmeBlogBundle
5353
========================== ==================
5454

5555
By convention, the ``getName()`` method of the bundle class should return the
@@ -58,8 +58,7 @@ class name.
5858
.. note::
5959

6060
If you share your bundle publicly, you must use the bundle class name as
61-
the name of the repository (``AcmeBlogBundle`` and not ``BlogBundle``
62-
for instance).
61+
the name of the repository (AcmeBlogBundle and not BlogBundle for instance).
6362

6463
.. note::
6564

@@ -68,7 +67,7 @@ class name.
6867
:class:`Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle`.
6968

7069
Each bundle has an alias, which is the lower-cased short version of the bundle
71-
name using underscores (``acme_blog`` for ``AcmeBlogBundle``). This alias
70+
name using underscores (``acme_blog`` for AcmeBlogBundle). This alias
7271
is used to enforce uniqueness within a project and for defining bundle's
7372
configuration options (see below for some usage examples).
7473

@@ -105,8 +104,8 @@ that automated tools can rely on:
105104
bundles are published under the MIT license, but you can `choose any license`_;
106105
* ``Resources/doc/index.rst``: The root file for the Bundle documentation.
107106

108-
The depth of sub-directories should be kept to the minimum for most used
109-
classes and files (two levels maximum).
107+
The depth of subdirectories should be kept to a minimum for the most used
108+
classes and files. Two levels is the maximum.
110109

111110
The bundle directory is read-only. If you need to write temporary files, store
112111
them under the ``cache/`` or ``log/`` directory of the host application. Tools
@@ -138,9 +137,9 @@ Classes
138137
-------
139138

140139
The bundle directory structure is used as the namespace hierarchy. For
141-
instance, a ``ContentController`` controller is stored in
142-
``Acme/BlogBundle/Controller/ContentController.php`` and the fully qualified
143-
class name is ``Acme\BlogBundle\Controller\ContentController``.
140+
instance, a ``ContentController`` controller which is stored in
141+
``Acme/BlogBundle/Controller/ContentController.php`` would have the fully
142+
qualified class name of ``Acme\BlogBundle\Controller\ContentController``.
144143

145144
All classes and files must follow the :doc:`Symfony coding standards </contributing/code/standards>`.
146145

@@ -158,8 +157,8 @@ Vendors
158157
A bundle must not embed third-party PHP libraries. It should rely on the
159158
standard Symfony autoloading instead.
160159

161-
A bundle should not embed third-party libraries written in JavaScript, CSS or
162-
any other language.
160+
A bundle should also not embed third-party libraries written in JavaScript,
161+
CSS or any other language.
163162

164163
Tests
165164
-----
@@ -183,10 +182,13 @@ Documentation
183182

184183
All classes and functions must come with full PHPDoc.
185184

186-
Extensive documentation should also be provided in the
187-
:doc:`reStructuredText </contributing/documentation/format>` format, under
188-
the ``Resources/doc/`` directory; the ``Resources/doc/index.rst`` file is
189-
the only mandatory file and must be the entry point for the documentation.
185+
Extensive documentation should also be provided in the ``Resources/doc/``
186+
directory.
187+
The index file (for example ``Resources/doc/index.rst`` or
188+
``Resources/doc/index.md``) is the only mandatory file and must be the entry
189+
point for the documentation. The
190+
:doc:`reStructuredText (rST) </contributing/documentation/format>` is the format
191+
used to render the documentation on symfony.com.
190192

191193
Installation Instructions
192194
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -232,7 +234,6 @@ following standardized instructions in your ``README.md`` file.
232234
{
233235
$bundles = array(
234236
// ...
235-
236237
new <vendor>\<bundle-name>\<bundle-long-name>(),
237238
);
238239
@@ -399,9 +400,9 @@ The ``composer.json`` file should include at least the following metadata:
399400
``name``
400401
Consists of the vendor and the short bundle name. If you are releasing the
401402
bundle on your own instead of on behalf of a company, use your personal name
402-
(e.g. ``johnsmith/blog-bundle``). The bundle short name excludes the vendor
403-
name and separates each word with an hyphen. For example: ``AcmeBlogBundle``
404-
is transformed into ``blog-bundle`` and ``AcmeSocialConnectBundle`` is
403+
(e.g. ``johnsmith/blog-bundle``). Exclude the vendor name from the bundle
404+
short name and separate each word with an hyphen. For example: AcmeBlogBundle
405+
is transformed into ``blog-bundle`` and AcmeSocialConnectBundle is
405406
transformed into ``social-connect-bundle``.
406407

407408
``description``
@@ -411,8 +412,7 @@ The ``composer.json`` file should include at least the following metadata:
411412
Use the ``symfony-bundle`` value.
412413

413414
``license``
414-
``MIT`` is the preferred license for Symfony bundles, but you can use any
415-
other license.
415+
a string (or array of strings) with a `valid license identifier`_, such as ``MIT``.
416416

417417
``autoload``
418418
This information is used by Symfony to load the classes of the bundle. The
@@ -497,3 +497,4 @@ Learn more
497497
.. _`Semantic Versioning Standard`: http://semver.org/
498498
.. _`Packagist`: https://packagist.org/
499499
.. _`choose any license`: http://choosealicense.com/
500+
.. _`valid license identifier`: https://spdx.org/licenses/

0 commit comments

Comments
 (0)