What is Schema and settings.yml files in config folder in drupal 8 modules

We people have seen that contributed modules have config folder.

Name (config) itself say its for some kind of configuration,

Yes, Config  folder would contain configuration for that module.

Most config folder will contain install folder where in  we can set our module settings by creating settings file there. modulename.settings.yml.

Let me explore it with an example,

You may have scenario to create module where in it will trigger email to email id on one particular page is hit

How create Common Functions to be used in modules drupal 8

 

Create a  File in Utility.php in modulename/src/ folder 

/**
 * @file
 * Contains \Drupal\mymodule\Utility
 */
namespace Drupal\mymodule;


class Utility {

     public  function  get_settings() {
       $return = \Drupal::config('mymodule.settings');
       return $return;
    }

}

Use Utitlity in your other module file

create MycustomController.php // refer how to create controller