Skip to content

Commit

Permalink
Implemented all the changes suggested by reviewers
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Jun 23, 2015
1 parent 490ead0 commit d8dee69
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions cookbook/bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,37 +75,33 @@ configuration options (see below for some usage examples).
Directory Structure
-------------------

The basic directory structure of an AcmeBlogBundle must read as follows (if you
use `PSR-4`_ the ``Acme/`` and ``BlogBundle/`` folders might not exist):
The basic directory structure of an AcmeBlogBundle must read as follows:

.. code-block:: text
<your-project>/
├─ ...
└─ src/
└─ Acme/
└─ BlogBundle/
├─ AcmeBlogBundle.php
├─ Controller/
├─ README.md
├─ Resources/
│ ├─ meta/
│ │ └─ LICENSE
│ ├─ config/
│ ├─ doc/
│ │ └─ index.rst
│ ├─ translations/
│ ├─ views/
│ └─ public/
└─ Tests/
<your-bundle>/
├─ AcmeBlogBundle.php
├─ Controller/
├─ README.md
├─ Resources/
│ ├─ meta/
│ │ └─ LICENSE
│ ├─ config/
│ ├─ doc/
│ │ └─ index.rst
│ ├─ translations/
│ ├─ views/
│ └─ public/
└─ Tests/
**The following files are mandatory**, because they ensure a structure convention
that automated tools can rely on:

* ``AcmeBlogBundle.php``: This is the class that transforms a plain directory
into a Symfony bundle;
* ``README.md``: This file contains the basic description of the bundle and it
usually shows some basic examples and links to its full documentation;
usually shows some basic examples and links to its full documentation (it
can use any of the markup formats supported by GitHub, such as ``README.rst``);
* ``Resources/meta/LICENSE``: The full license for the code. The license file
can also be stored in the bundle's root directory to follow the generic
conventions about packages;
Expand Down Expand Up @@ -220,7 +216,7 @@ following standardized instructions in your ``README.md`` file.
Step 2: Enable the Bundle
-------------------------
Then, enable the bundle by adding the following line in the `app/AppKernel.php`
Then, enable the bundle by adding the following in the `app/AppKernel.php`
file of your project:
```php
Expand Down Expand Up @@ -315,6 +311,11 @@ Retrieve the configuration parameters in your code from the container::
Even if this mechanism is simple enough, you should consider using the more
advanced :doc:`semantic bundle configuration </cookbook/bundles/configuration>`.

Versioning
----------

Bundles must be versioned following the `Semantic Versioning Standard`_.

Services
--------

Expand Down Expand Up @@ -344,6 +345,12 @@ The ``composer.json`` file should include at least the following metadata:
* ``type``, use the ``symfony-bundle`` value;
* ``license``, ``MIT`` is the preferred license for Symfony bundles, but you
can use any other value.
* ``autoload``, this information is used by Symfony to load the classes of the
bundle. The `PSR-4`_ autoload standard is recommended for modern bundles, but
`PSR-0`_ standard is also supported.

In order to make it easier for developers to find your bundle, register it on
`Packagist`_, the official repository for Composer packages.

Learn more from the Cookbook
----------------------------
Expand All @@ -352,3 +359,5 @@ Learn more from the Cookbook

.. _`PSR-0`: http://www.php-fig.org/psr/psr-0/
.. _`PSR-4`: http://www.php-fig.org/psr/psr-4/
.. _`Semantic Versioning Standard`: http://semver.org/
.. _`Packagist`: https://packagist.org/

0 comments on commit d8dee69

Please sign in to comment.