Skip to content

Instantly share code, notes, and snippets.

@gozan
Forked from mabasic/helpers.php
Created May 31, 2021 07:40
Show Gist options
  • Select an option

  • Save gozan/b07e6e41bacf15b3b996dc06c734b390 to your computer and use it in GitHub Desktop.

Select an option

Save gozan/b07e6e41bacf15b3b996dc06c734b390 to your computer and use it in GitHub Desktop.
config_path function for Lumen framework
<?php
if ( ! function_exists('config_path'))
{
/**
* Get the configuration path.
*
* @param string $path
* @return string
*/
function config_path($path = '')
{
return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
}
}

Instructions

Create a file called helpers.php in the app/ directory. Paste the code inside it.

Go to composer.json and add to autoload:

"autoload": {
    ...
    "files": [
        "app/helpers.php"
    ]
},

Run composer dump-autoload to load the newly created helpers file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment