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

[Bundles] Documented the getPublicDir() method #11930

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 1 commit into from
Jul 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions 32 bundles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ Bundle Directory Structure

The directory structure of a bundle is meant to help to keep code consistent
between all Symfony bundles. It follows a set of conventions, but is flexible
to be adjusted if needed. Take a look at AcmeDemoBundle, as it contains some
of the most common elements of a bundle:
to be adjusted if needed:

``Controller/``
Contains the controllers of the bundle (e.g. ``RandomController.php``).
Expand Down Expand Up @@ -118,6 +117,35 @@ database, create and validate forms, create translations for your application,
write tests and much more. Each of these has their own place and role within
the bundle.

Overridding the Bundle Directory Structure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Some of the bundle directories are conventions that can be overridden if needed.
For example, the **public directory**, which by default is located at
``<your-bundle>/Resources/public/``, can be changed by defining the
``getPublicDir()`` method in the bundle class::

// src/Acme/TestBundle/AcmeTestBundle.php
namespace App\Acme\TestBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeTestBundle extends Bundle
{
// ...

// the returned value must be relative to the bundle root directory
// (public dir is now <your-bundle>/public/ instead of <your-bundle>/Resources/public/)
public function getPublicDir(): string
{
return 'public/';
}
}

.. versionadded:: 4.4

The ``getPublicDir()`` method was introduced in Symfony 4.4.

Learn more
----------

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.