PHPackages                             apolinux/config - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. apolinux/config

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

apolinux/config
===============

Manage configurations using dot route

v0.7(11mo ago)09MITPHPPHP &gt;7.4

Since Oct 13Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/apolinux/configfile)[ Packagist](https://packagist.org/packages/apolinux/config)[ RSS](/packages/apolinux-config/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Config File
===========

[](#config-file)

Set or get configuration items from dictionary style array inside file.

The configuration is wrote in a file contains an array that must be returned.

```
// file called config.php
return [
   'item1' => 'value1' ,
   'item2' => [
     'item3 => 'value2',
    ],
  ..
 ];

```

Then the items inside array can be obtained using dot notation, for example, for item3:

$result = Config::get('config.item2.item3');

The first part of notation 'config' is the filename without .php extension.

instalation
-----------

[](#instalation)

```
composer require apolinux/configfile

```

### Example

[](#example)

In the current directory there is a php file called myconfig.php that have the following code:

```
// myconfig.php

return [
  'item' => ['item2' => ['item3' => ['item4' => ['http://uno']]]],
  'list' => ['blablabla'],
  'other' => ['a' => 'b', 'c' => 'd', 'e' => 'f'],
  'alt' => ['alt1' => ['ttt ' => [1, 2, 3, 4, 5, 10000]]],
];

```

Then we get the items:

```
