Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bundle Naming #3616

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

Closed
ossinkine opened this issue Feb 27, 2014 · 9 comments
Closed

Bundle Naming #3616

ossinkine opened this issue Feb 27, 2014 · 9 comments
Labels
actionable Clear and specific issues ready for anyone to take them. good first issue Ideal for your first contribution! (some Symfony experience may be required) hasPR A Pull Request has already been submitted for this issue.

Comments

@ossinkine
Copy link

On https://github.com/symfony/symfony-docs/blob/master/cookbook/bundles/best_practices.rst says that namespace must follow the technical interoperability standard PSR-0. Must namespace follow the standard PSR-4? In particular, is it allowed to use the namespace for bundle MyBlogBundle? E.g. can I place my bundle class in src/MyBlogBundle/MyBlogBundle.php?

@wouterj
Copy link
Member

wouterj commented Feb 27, 2014

Yes, you can do it wherever you like. :)

We may need to update that article though, by adding the PSR-4 standard information. Thanks for notifying us! (you if have some time, youcan also hit the "edit" button yourself and update the article using PSR-4, that'll be very great!)

@xabbuh
Copy link
Member

xabbuh commented Feb 27, 2014

Is the PSR-4 standard really worth to be mentionend here? I mean it doesn't affect any of the guidelines we describe, does it?

@ossinkine
Copy link
Author

@xabbuh PSR-0 allows namespaces like \VendorName\NamespaceName, PSR-4 allows namespaces \NamespaceName.
Thus PSR-0 does not allow to create a bundle src/MyBlogBundle/MyBlogBundle.php, only src/MyCompany/MyBlogBundle/MyCompanyBlogBundle.php

@ossinkine
Copy link
Author

@wouterj I'd like to, but my English is very bad for it.

@wouterj
Copy link
Member

wouterj commented Feb 27, 2014

@xabbuh it doesn't affect the text, however it does change the table with examples.

@ossinkine don't worry about your english. 90% of de doc contributors are bad english speaking non-natives (including myself). We'll help you and after all, we have a very friendly merger (@weaverryan) which will fix all bad english in a PR after the merge 😆

But well, now I think about it. Nothing in the article talks about the location of the bundle, only about the namespace and name of a bundle. So it isn't affected by PSR-4. Where did you think we were talking about locations? (if we know that, we can add a tip box saying something like "If your bundle uses PSR-4, the namespace may differ from the actual location of the bundle (e.g. Acme\Bundle\Social\BlogBundle can live in src/BlogBundle).")

@ossinkine
Copy link
Author

@wouterj Yes, I mean that file src/MyBlogBundle/MyBlogBundle.php has a namespace MyBlogBundle and class name MyBlogBundle, is it allowed?

@xabbuh
Copy link
Member

xabbuh commented Feb 28, 2014

@ossinkine Your fully qualified namespace would even with PSR-4 be something like \Me\MyBlogBundle. The only difference actually is the depth of your directory structure under src/.

phansys added a commit to phansys/symfony-docs that referenced this issue Sep 21, 2014
| Q             | A
| ------------- | ---
| Doc fix?      | no
| New feature?  | no
| Applies to    | 2.0+
| Tests pass?   | yes
| Fixed tickets | symfony#3616
@weaverryan
Copy link
Member

I do think we should mention that you're allowed to follow PSR-0 or PSR-4.

I also think that the example table should be updated to give better examples. Specifically, You should have a vendor namespace then your bundle name. I think examples like Acme\Bundle\BlogBundle and Acme\Bundle\Social\BlogBundle are out of date - sure you can do this, but I don't think we should recommend this deep of a namespace structure for your bundles.

Even the Directory Structure section isn't quite right - we talk about a HelloBundle, but it should be AcmeHelloBundle. Enough time has gone by, that this whole entry needs a re-read with some facelifts.

Thanks!

@weaverryan
Copy link
Member

And btw, this entry is about re-usable bundles, not application-specific bundles, so we can really target our information at that audience - see #4250.

Thanks!

@wouterj wouterj added the hasPR A Pull Request has already been submitted for this issue. label Feb 19, 2015
weaverryan pushed a commit that referenced this issue May 22, 2015
| Q             | A
| ------------- | ---
| Doc fix?      | no
| New feature?  | no
| Applies to    | 2.0+
| Tests pass?   | yes
| Fixed tickets | #3616
weaverryan added a commit that referenced this issue May 22, 2015
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #4255).

Discussion
----------

Updated autoload standard to PSR-4.

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New feature?  | no
| Applies to    | 2.0+
| Tests pass?   | yes
| Fixed tickets | #3616

Commits
-------

d9a2f61 Updated autoload standard to PSR-4.
weaverryan added a commit that referenced this issue Jun 26, 2015
… (javiereguiluz)

This PR was merged into the 2.3 branch.

Discussion
----------

Updated the best practices article for reusable bundles

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3+
| Fixed tickets | #3616

Commits
-------

286631d Added a blank line beteen definition list items
776eaee Reworded as a definition list
4276ced Added back some information wrongly removed during the rebase
fa0b902 Fixed a minor syntax issue
9981193 Minor fixes and added a cross link
a391563 Updated the best practices article for reusable bundles
javiereguiluz pushed a commit to javiereguiluz/symfony-docs that referenced this issue Sep 2, 2015
| Q             | A
| ------------- | ---
| Doc fix?      | no
| New feature?  | no
| Applies to    | 2.0+
| Tests pass?   | yes
| Fixed tickets | symfony#3616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. good first issue Ideal for your first contribution! (some Symfony experience may be required) hasPR A Pull Request has already been submitted for this issue.
Projects
None yet
Development

No branches or pull requests

4 participants