Posted inTechnology / php / Programming

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.

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.

htdocs/social-api/src/Pakainfo/social/Config

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);
    }
}

Config::add(
    [
       /*
        |--------------------------------------------------------------------------
        | 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'  => 'tamilrokets@123',
            'db_name' => 'tamilrokers';
        ]
    ]
);

/opt/lampp/htdocs/social-api/src/Pakainfo/social/Database

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 :

Summary

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.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

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

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype