Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Bundle repository directory structure #5691

Closed
@theofidry

Description

@theofidry

As statedin the official doc, the current structure of a bundle should be:

<your-bundle>/├─ AcmeBlogBundle.php├─ Controller/├─ README.md├─ LICENSE├─ Resources/│   ├─ config/│   ├─ doc/│   │  └─ index.rst│   ├─ translations/│   ├─ views/│   └─ public/└─ Tests/

Which many developers translate as the following for a repository:

AcmeBlogBundle.phpController/README.mdLICENSEResources/ ├─ config/ ├─ doc/ │  └─ index.rst ├─ translations/ ├─ views/ └─ public/Tests/

with acomposer.json containing:

"autoload": {"psr-4": {"Acme\\BlogBundle\\":"" }}

In short, everything at the root. This practice has two harmful results:

  • As everything is placed in the root, it easily becomes hard to tell the difference between files related to the source code of the bundle and configuration files such ascomposer.json,.gitignore,.travis.yml,behat.yml,phpunit.xml.dist and so just to name a few common ones
  • We include code related to tests in the autoloadingeven in production mode

Whereas doing the following:

src/├─ AcmeBlogBundle.php├─ Controller/└─ Resources/   ├─ config/   ├─ doc/   │  └─ index.rst   ├─ translations/   ├─ views/   └─ public/tests/README.mdResourcescomposer.json

with:

"autoload": {"psr-4": {"Acme\\BlogBundle\\":"src" }},"autoload-dev": {"psr-4": {"Acme\\BlogBundle\\Tests\\":"tests" }}

would address both those issues.

Obviously, changing the architecture of the existing bundles is not always doable as it will break lots of PR and for the bundles which are meant to be used as dev dependencies that's not an issue.

cc@Seldaek

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp