@@ -13,6 +13,8 @@ Support Package For Tamedevelopers
1313 * [ Env Update] ( #env-update )
1414* [ Server] ( #server )
1515 * [ Get Servers] ( #get-servers )
16+ * [ Create Custom Config] ( #create-custom-config )
17+ * [ Create Config Template File] ( #create-config-template-file )
1618* [ Autoload Register] ( #autoload-register )
1719* [ Helpers Functions] ( #helpers-functions )
1820* [ Error Dump] ( #error-dump )
@@ -22,7 +24,7 @@ Support Package For Tamedevelopers
2224
2325## Requirements
2426
25- - ` >= php7.2.5 + `
27+ - ` >= php 8.0 + `
2628
2729## Installation
2830
@@ -31,7 +33,7 @@ Prior to installing `support package` get the [Composer](https://getcomposer.org
3133** Step 1** — update your ` composer.json ` :
3234``` composer.json
3335"require" : {
34- "tamedevelopers/support" : " ^1.0.3 "
36+ "tamedevelopers/support" : " ^1.0.0 "
3537}
3638```
3739
@@ -143,7 +145,6 @@ Env::updateENV('DB_PASSWORD', 'newPassword');
143145env_update('DB_CHARSET', 'utf8', false);
144146```
145147
146-
147148## Server
148149- Return instance of ` Server `
149150
@@ -163,6 +164,61 @@ Server::getServers();
163164server()->getServers('domain');
164165```
165166
167+ ### Create Custom Config
168+ - With this helper you can be able to create your own custom config by extending the Default Config Method
169+ - When using this model, make sure every of your php file returns an associative array for the key to work
170+
171+ | Params | Description |
172+ | ---------------| -------------------|
173+ | key | File array key |
174+ | default | Default value if no data is found from the key |
175+ | folder | Folder to search from and Default folder is ` config ` |
176+
177+ ```
178+ use Tamedevelopers\Support\Server;
179+
180+ Server::config('tests.lang.email', [], 'Tests');
181+ ```
182+
183+ - Create our own config to extends the default
184+ ```
185+ /**
186+ * Custom Language Handler
187+ *
188+ * @param mixed $key
189+ * @return mixed
190+ */
191+ function __($key){
192+
193+ // since the config only takes the filename follow by dot(.) and keyname
194+ // then we can manually include additional folder-name followed by / to indicate that it's a folder
195+ // then message.key_name
196+ // To make this Laravel kind of language, we can add the default value to be returned as the key
197+ // Do not forget that it starts from your root base directory, as the Package already has your root path
198+
199+ return config("en/message.{$key}", "message.{$key}", 'Lang');
200+ }
201+
202+
203+ --- Structure of folder example
204+ --- (d) for directory and (f) for file
205+
206+ Base -d ---
207+ Lang -d --
208+ en -d
209+ message.php -f
210+ error.php -f
211+
212+ tr -d
213+ message.php -f
214+ error.php -f
215+ ```
216+
217+ - or -- ` Helpers Function `
218+ ```
219+ server()->config("app.name");
220+ ```
221+
166222## Autoload Register
167223- Takes an ` string\|array ` as param
168224 - You can use register a folder containing all needed files
0 commit comments