-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Updated the Best Practices for Symfony 4 and Flex #8599
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
Updated the Best Practices for Symfony 4 and Flex #8599
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! :)
Probably the section "Template Locations" needs changes too.
best_practices/tests.rst
Outdated
yield ['/post/fixture-post-1']; | ||
yield ['/blog/category/fixture-category']; | ||
yield ['/archives']; | ||
yield [.]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yield [.]
=> // ...
?
This is now ready for review. Here is the list of added/removed/changed best practices: Added
Removed
Changed-Use the Symfony Installer to create new Symfony-based projects.
+Use Composer and Symfony Flex to create and manage Symfony applications. -Make your controller extend the FrameworkBundle base controller...
+Make your controller extend the ``AbstractController`` base controller... -Store the translation files in the ``app/Resources/translations/`` directory.
+Store the translation files in the ``translations/`` directory at the root of your project. -Store all your application's templates in ``app/Resources/views/`` directory.
+Store the application templates in the ``templates/`` directory at the root of your project. -Define your Twig extensions in the ``AppBundle/Twig/`` directory.
+Define your Twig extensions in the ``src/Twig/`` directory. -Store your assets in the ``public/`` directory.
+Store your assets in the ``assets/`` directory at the root of your project. -Use Assetic to compile, combine and minimize web assets, unless you're
-comfortable with frontend tools like GruntJS.
+Use `Webpack Encore`_ to compile, combine and minimize web assets. -For fine-grained restrictions, define a custom security voter;
-For restricting access to *any* object by *any* user via an admin
-interface, use the Symfony ACL.
+Define a custom security voter to implement fine-grained restrictions. |
best_practices/business-logic.rst
Outdated
:doc:`Service autowiring </service_container/autowiring>` is a feature provided | ||
by Symfony's Service Container to manage services with minimal configuration. | ||
It reads the type-hints on your constructor (or other methods) and automatically | ||
passes you the correct services. It can also add :doc:`service tags </service_container/tags>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It passes the correct services to the methods, not 'you'.
best_practices/business-logic.rst
Outdated
the class is auto-registered as a service. | ||
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`, | ||
this class is auto-registered as a service whose ID is ``App\Utils\Slugger`` (or | ||
simply ``Slugger::class`` if the class is already imported in your code). | ||
|
||
Traditionally, the naming convention for a service was a short, but unique | ||
snake case key - e.g. ``app.utils.slugger``. But for most services, you should now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this paragraph.
Use Composer and Symfony Flex to create and manage Symfony applications. | ||
|
||
`Composer`_ is the package manager used by modern PHP application to manage their | ||
dependencies. `Symfony Flex`_ is a Composer plugin designed to automatize some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
automate?
`public checksums repository`_ and follow `these steps`_ to verify the | ||
signatures. | ||
The technical requirements to run Symfony are simple. If you want to check | ||
if your system meets those requirements, read :doc:`/reference/requirements`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about recommending using the req-checker
for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree! The linked article (https://symfony.com/doc/master/reference/requirements.html) was revamped recently to remove everything and just explain how to use req-checker.
This PR was merged into the 3.3 branch. Discussion ---------- Minor reword in autowiring introduction I used this in the reword of the Best Practices docs and Fabien [added this comment](#8599 (comment)) because he didn't like a phrase of this paragraph. This PR changes that too here. Commits ------- c84cff8 Minor reword in autowiring introduction
936bd11
to
335e461
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
This is huge work Javier. THANK YOU!!! |
…ereguiluz) This PR was squashed before being merged into the master branch (closes #8599). Discussion ---------- Updated the Best Practices for Symfony 4 and Flex Still WIP. Some controllers have not been reviewed yet. Commits ------- 335e461 Fixed after Fabien's review 68b7a18 Fixed some missing references 9794c0b Updated more contents b997c1e Updated the Best Practices for Symfony 4 and Flex
Still WIP. Some chapters have not been reviewed yet.