Home » PHP Config Class to store configuration data

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.

Read Also:  Could not fully remove the plugin in Wordpress

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.

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';



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 :

Read Also:  AngularJS GET Data in Ajax example using $http


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 infinityknow.com 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.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Google 1 share price today
  2. Read Also:  PHP Convert currency into number to words string to money conversion
  3. Read Also:  How to write SQL Sub Query in PHP with MySQLi
  4. Read Also:  Vuejs autocomplete search with typeahead js
  5. Read Also:  jQuery Ajax QR Code Generator PHP script Download
  6. Read Also:  Simple Laravel Contact Us Form With Email Example
  7. Read Also:  Great UNIX Commands Tutorial for Beginners
  8. Read Also:  Laravel 6 Get Last Inserted ID using Eloquent
  9. Read Also:  Google 1 share price today
  10. Read Also:  Laravel 6 Get Last Inserted ID using Eloquent

Leave a Comment

Your email address will not be published. Required fields are marked *