Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

public_path lumen not defined

1- add helper.php in your app directory then put the helper functions:

<?php
if(!function_exists('public_path'))
{

        /**
        * Return the path to public dir
        * @param null $path
        * @return string
        */
        function public_path($path=null)
        {
                return rtrim(app()->basePath('public/'.$path), '/');
        }
}

if(!function_exists('storage_path'))
{

        /**
        * Return the path to storage dir
        * @param null $path
        * @return string
        */
        function storage_path($path=null)
        {
                return app()->storagePath($path);
        }
}



2- the next step is to autoload the file:

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

3- and in the final type this command:

composer dump-autoload
 
PREVIOUS NEXT
Tagged: #lumen #defined
ADD COMMENT
Topic
Name
8+3 =