composer-config-plugin icon indicating copy to clipboard operation
composer-config-plugin copied to clipboard

Add runtime-only mode

Open samdark opened this issue 5 years ago • 5 comments

Could be useful for debug/development use. See #84.

samdark avatar Jun 19 '20 13:06 samdark

Please think about how developer uses configuration. Configuration changes as app evolves.

Rebuilding config manually every time after each change in settings is annoying. It is doubling developer work.

Automated rebuild on every app run is extra work for hardware, it is waste of resources and time and should be avoided.

There is no need to write builded configaration to disk in development environment. It is meaningless.

Just read whole thing in memory and let the app run with it.

Nex-Otaku avatar Jun 19 '20 13:06 Nex-Otaku

There are two modes: development/debug and production.

In development mode:

  1. It's a good idea to rebuild config every request.
  2. There's no need to write cache to disk.

In production mode:

  1. We can save resources by not rebuilding every request.
  2. We have to write cache to disk.

samdark avatar Jun 19 '20 14:06 samdark

We can save resources by not rebuilding every request

It's not about resources. It's about latency. It can take more time to rebuild config (read and merge all the files) then request processing itself.

hiqsol avatar Jun 19 '20 14:06 hiqsol

In case rebuild() is done in debug mode we are already doing that so there will be a bit less time spent since we'll not write to files and read from files.

samdark avatar Jun 19 '20 17:06 samdark

Partially done. Files are still dumped but there's no need for composer dump-autoload anymore if rebuild() is called.

samdark avatar Jun 26 '20 22:06 samdark