Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gopal-g
Forked from mabasic/helpers.php
Created June 2, 2017 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gopal-g/24ce1c7f8cff47e479ecf024084fdbf9 to your computer and use it in GitHub Desktop.
Save gopal-g/24ce1c7f8cff47e479ecf024084fdbf9 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 files to autoload so that it looks like this:

"autoload": {
    "psr-4": {
        "App\\": "app/"
    },
    "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