# Best Practice: Location of Configuration

**URL:** <https://discourse.laminas.dev/t/best-practice-location-of-configuration/3703>\
**Category:** Components & MVC\
**Tags:** laminas-mvc\
**Created:** [May 24, 2024, 6:41pm UTC](https://discourse.laminas.dev/t/best-practice-location-of-configuration/3703 "2024-05-24T18:41:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Tyrsson](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/tyrsson/32/1664_2.png) [@Tyrsson](https://discourse.laminas.dev/u/Tyrsson)\
**Post date:** [May 25, 2024, 12:00am UTC](https://discourse.laminas.dev/t/best-practice-location-of-configuration/3703/2 "2024-05-25T00:00:24Z")

</div>

Module classes and ConfigProvider classes serve two different purposes.

Basically:  
Module classes provides support to Laminas MVC applications.  
ConfigProviders provide support to Mezzio applications.

In mezzio the ConfigProvider is added to the array to seed ConfigAggregator.

In MVC the module manager calls the Module.php files iirc based on the /config/autoload/modules.config.php or application.config.php at the application config level. Basically providing the list of modules that expose Module.php files to be called.

In components that support both the most common approach is to create an instance of ConfigProvider and return the providers method call as the MVC supported keys value through the getConfig method of the Module class.

Not sure if you have read this but it covers all things config.

> **[Advanced Configuration Tricks - tutorials - Laminas Docs](https://docs.laminas.dev/tutorials/advanced-config/)**
>
> Learn how to create laminas-mvc applications, get in-depth guides into components, and discover how to migrate your applications to version 3!

There is important information in this one as well.

> **[laminas-component-installer - Laminas Docs](https://docs.laminas.dev/laminas-component-installer/)**
>
> Composer plugin for injecting modules and configuration providers into application configuration

---

_[View the full topic](https://discourse.laminas.dev/t/best-practice-location-of-configuration/3703)._
