https://github.com/hamoda-dev/configure
PHP Configuration Libaray
https://github.com/hamoda-dev/configure
Last synced: 30 days ago
JSON representation
PHP Configuration Libaray
- Host: GitHub
- URL: https://github.com/hamoda-dev/configure
- Owner: hamoda-dev
- Created: 2020-08-03T07:21:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-26T15:20:29.000Z (almost 5 years ago)
- Last Synced: 2025-06-19T22:53:07.551Z (8 months ago)
- Language: PHP
- Size: 4.38 MB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hamoda-Dev/Configure
PHP Configuration library. Use to get all your app configuration from files for diffrent enviroment { development, prodection, ...}
It's Easy to use just a few steps to done with it
## installtion
install via composer :
```sh
composer require hamoda-dev/configure
```
## Configurations
1 - copy this to your composer.json file
```
"scripts": {
"configure-init": [
"cp -r -d vendor/hamoda-dev/configure/sample/config config",
"cp -r vendor/hamoda-dev/configure/sample/configure.json configure.json"
]
}
```
2 - run this command in your project to create config directory & configure.json
```sh
composer run-script configure-init
```
now you have config directory and configure.json
#### Config Directory
containe to directory { development, production }
- inside development put your development configuration files
- inside production put your production configuration files
you can switch betwen the environments in the configure.json file
##### configure.json
```
{
"config_path" : "config",
"environment" : "development"
}
```
in ``` "environment" : "here you switching environment" ``` => ``` develoment ``` or ``` production ```
## Syntax
```
'http://localhost',
'mysql' => [
'driver' => 'mysql',
'url' => '',
'host' => '127.0.0.1',
'port' => '3306',
'database' => 'forge',
'username' => 'root',
'password' => '',
'unix_socket' => '',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
]
```
## Uesge
you can access all your configuration via ``` config($parm) ``` . Accept one parametr = config that you need it
from previus syntax example
```config('app_url')``` the output shuld be : ```http://localhost```
if you need to deeper value just use ```.``` betwen the keys
``` config('mysql.host') ``` the output shuld be : ```127.0.0.1```
You Can Add Any Number of configuration files an access it very easy
Enjoy :)