PHP code example of skywarth / laravel-config-mapper

1. Go to this page and download the library: Download skywarth/laravel-config-mapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

skywarth / laravel-config-mapper example snippets


#./config/mammals/room/elephant.php

return [
    'enabled'=>env('MAMMALS_ROOM_ELEPHANT_ENABLED',1),
    'permissions'=>[
        'allowed_to_walk'=>env('MAMMALS_ROOM_ELEPHANT_PERMISSIONS_ALLOWED_TO_WALK',1),
        'allowed_to_sleep'=>env('MAMMALS_ROOM_ELEPHANT_PERMISSIONS_ALLOWED_TO_SLEEP',1)
    ]
];

      #./config/mammals/room/elephant.php
      
        return [
        'enabled'=>env('MAMMALS_ROOM_ELEPHANT_ENABLED',1),
        'permissions'=>[
            'allowed_to_walk'=>'automap' //NOTICE HERE
            'allowed_to_sleep'=>env('MAMMALS_ROOM_ELEPHANT_PERMISSIONS_ALLOWED_TO_SLEEP',1)
        ]
      ];
      

      #./config/mammals/room/elephant.php
      
        return [
        'enabled'=>env('MAMMALS_ROOM_ELEPHANT_ENABLED',1),
        'permissions'=>[
            'allowed_to_walk'=>env('MAMMALS.ROOM.ELEPHANT.PERMISSIONS.ALLOWED_TO_WALK','automap') //NOTICE HERE
            'allowed_to_sleep'=>env('MAMMALS_ROOM_ELEPHANT_PERMISSIONS_ALLOWED_TO_SLEEP',1)
        ]
      ];

#./config/mammals/room/elephant.php

return [
    'enabled'=>'automap',
    'permissions'=>[
        'allowed_to_walk'=>'automap',
        'allowed_to_sleep'=>env('MAMMALS_ROOM_ELEPHANT_PERMISSIONS_ALLOWED_TO_SLEEP',1)
    ]
];

php artisan vendor:publish --provider="Skywarth\LaravelConfigMapper\LaravelConfigMapperServiceProvider" --tag="config"

your-laravel-project/
├── config/
│   ├── filesystems.php
│   ├── app.php
│   ├── auth.php
│   ├── queue.php
│   ├── **tiger.php**
│   ├── mammals/
│   │   ├── panda.php
│   │   ├── dog.php
│   │   └── room/
│   │       └── elephant.php
│   └── non-mammals/
│       └── penguin
├── app
├── storage
├── public
├── .env
└── .env.example