Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • General Configurations in CakePHP 3.x

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 331
    Comment on it

    Welcome to FindNerd. We are going to discuss the general configuration in CakePHP 3.x. If you are working with conventions then there is no extra configuration required so we discuss the general ones.

    You can check the configurations files in config folder. If you want to add new configuration files then you need to load these files in bootstrap.php. You can check the code below to load.

     

    Configure::load('extra_config', 'default');

     

    General configurations will be managed by Cake/Core/Configure. There is config() method provided by adapter based classes and it makes the configuration easy to manage and simple to handle. You can check the app.default.php file for general options.

    We are going to discuss the few general configurations and these uses. Please have a look.

     

    A) debug : Default value is true. It means errors and warning will be shown. You can set the value to false to hide the errors/warnings.

     

    B) App.namespace : Default value is App. It is namespace to maintain the classes inside it. If you are changing default value then you need to change the composer.json file for the same.

     

    C) App.baseUrl : You need to uncomment this line if you are not using mod_rewrite with your application and don't forgot to delete the .htaccess file too.

     

    D) App.base : Default value is false. It means base directory will be auto detected. If you want to set the other folder then you need to start the string with forward slash(/) like /baseone.

     

    E) App.encoding : Default value is set to UTF-8. It should be match with database encoding to work.

     

    F) App.webroot : Default value is set to webroot. Make the change if required.

     

    G) App.wwwRoot : It uses constant WWW_ROOT which includes web root directory path. It is set inside paths.php file.

     

    H) App.fullBaseUrl : Default value is false. It is used to generate the absolute path. You can use $_SERVER variable if it is set to false or you can set the root path as its value.

     

    I) App.imageBaseUrl : Default value is 'img/'. It is a path of public images inside webroot folder.

     

    J) App.cssBaseUrl : It is a path to public css files under webroot. Default value is 'css/'.

     

    K) App.jsBaseUrl : Default value is 'js/'. It is a path of public js files inside webroot.

     

    L) App.paths : It defines the path for plugins, view templates as well as locales files.

     

    M) Security.salt : It is used to set the random string for encryption/hashing.

     

    N) Asset.timestamp : It is useful to capture the last modified timestamp for files at end of asset files URLs when using proper helpers. It has three values. If false then do nothing. Default is commented so value is false. If true then append the timestamp. If force then always add the timestamp.

     

     

    Thank you for being with us!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
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: