Configuration

Introduction

All of the configuration files for the ،Kiaan framework are stored in the resources/config directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you.

These configuration files allow you to configure things like your database connection information, your mail server information.

Define a variable

To define a variable add to array in file like "resources/config/app.php".

resources/config/app.php
return [
    "framework" => "kiaan"
];

Assign the value

To add a value to an existing key or create it if it does not exist and assign the value to it.

Config::set("app", "name", "Hassan");

and You can change key name of variable.

Config::name("app", "setting.website", "setting.name");

Check key

To check if a key exists, it returns true, and if it doesn't, it returns false.

Config::has("app", "name");

Get value

Get value of key.

Config::get("app", "name");

You can set a default value when the key is not present.

Config::get("app", "name", "Hassan");

use config() helper function to get value of key.

config("app", "name");

and you can get all keys using all() method.

Config::all();

Delete keys

You can delete the key using delete() method.

Config::delete("app.name");

You can delete all the keys use destroy() method.

Config::destroy();

Database

You can use configurations across the database and store from the database using db() method.

Config::db()->get("name");

Last updated