Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to store constants in laravel 5.0

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.68k
    Comment on it

    In laravel 5.0 the way to define constants and use them through out the project. Following are the steps to accomplish it:-

    Step 1st :- Creating a separate file under /config folder named as constants.php ( it can be any name) for storing all constants.

    return [
        'CONTROLLER_PATH' => "App\Http\Controllers\\"

    Step 2nd :- Define the file name in composer.json under "autoload" with "files" param for automatically loading the file.

    "autoload": {
                    "files": [
                    ]     }

    Step 3rd :- Running the following command in command line.

    $ composer dumpautoload 

    Step 4th :- Syntax for using the constants.


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: