Understanding Environments
Every sylius application is combination of code and set of configuration that dictates how that code should functon. The configuration may define the database being used, whether or not something should be cached or how verbose logging should be. In Symfony, the idea of the “environments” that the same codebase can be run using multiple different configurations. For example, the “dev” environment should use configuration that makes development easy and friendly, while the “prod” environment should use a set of configuration optimized for speed.
Types of environments
- Development – Local development.
- Production – Production severs.
- Test – Automated testing.
Development
Development environment (or) “dev” as the name suggests should be used for development purpose only. It is much slower than production, because it uses much less aggressive caching and does a lot of processing on every request. However, it allows you to add new features or fix bugs quickly without worrying about clearing the cache after every change. Sylius console runs in “dev” environment by default. You can access the website in “dev” mode in the “/index.php” file in the “public/” directory in the website root.
Production
Production environment (or) “prod” is your live website environment. It uses proper caching and is much faster than other environments. It uses live APIs and sends out all e-mails. To run sylius console “prod” environment, add the following parameters to every command call: “bin/console –env=prod –no-debug cache:clear”. You can access the website in “prod” mode in the “/index.php” file in the website root “public/” directory (or) just “/” path on apache.
Test
Test environment (or) test is used for the automated testing. Most of the time you will not access it directly. To run sylius console in “test” environment, add the following parameters to every command call: “bin/console –env=test cache:clear”.
Leave a Reply
You must be logged in to post a comment.