PHP Config Class to store configuration data

Today, We want to share with you PHP Config Class to store configuration data.In this post we will show you wordpress plugin require another plugin, hear for Config Class Object Oriented PHP for Beginners we will give you demo and example for implement.In this post, we will learn about $settings array or Config Class to store project settings with an example.

PHP Config Class to store configuration data

There are the Following The simple About PHP Config Class to store configuration data Full Information With Example and source code.

As I will cover this Post with live Working example to develop php application configuration,, so the PHP Config Class – Setting and Getting Property Values is used for this example is following below.

Also Read This πŸ‘‰   jQuery Multiple Tag Input with Dynamic Autocomplete Example

PHP classes to store configuration data

PHP OOP Configuration class. Used for managing runtime Database connection or more configuration information.It’s Used to store a dynamic variable in Configure.


namespace Pakainfo\social\Config;

class Config
    protected static $config = array();

    private $channel_name;
    public function __construct($channel_name)
        $this->channel_name = $channel_name;
    public function get($name, $default = null)
        return isset(self::$config[$this->channel_name][$name]) ? self::$config[$this->channel_name][$name] : $default;
    public static function add($parameters = array())
        self::$config = array_merge(self::$config, $parameters);

        | mysql Database connection
        | This file is for setting the credentials for mysql api db_username and db_password.
        'mysql' => [
            'db_username' => 'web_blogs_tamilrokes_new_link',
            'db_password'  => '[email protected]',
            'db_name' => 'tamilrokers';

Free Live Chat for Any Issue



namespace Pakainfo\social\Database;
use Pakainfo\social\Config\Config;

class Database
    public $website_name;
    private $image_dir;
    private $db_password;
    private $db_username;
    private $db_name;
    private $config;

    public function __construct($channel_auth)
        $this->config = new Config("mysql");
        $this->website_name = $channel_auth['website_name'];
        $this->db_password = $this->config->get("db_password");
        $this->db_username = $this->config->get("db_username");
        $this->image_dir = $channel_auth['image_dir'];
        $this->db_name = $this->config->get("db_name");

Web Programming Tutorials Example with Demo

Read :

Also Read This πŸ‘‰   difference between two times in php - How to calculate the difference between two dates in PHP?


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP DbConfig Class to store configuration data.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.