ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Create custom params file in yii framework

Yii framework is come with powerful inbuild features eg.
1. Model-View-Controller (MVC) design pattern
2. Database Access Objects (DAO)
3. Custom Query Builder, Active Record (AR) and DB Migration
4. Form input and validation
5. AJAX-enabled widgets
6. Authentication and authorization
7. Layout Skinning and theming
8. Web services
9. Internationalization (I18N) and localization (L10N)
10. Layered caching scheme
11. Error handling and logging
12. Security
13. Unit and functionality testing
14. Automatic code generation (Gii Module)
15. Friendly with third-party code
16. Detailed documentation
17. Extension library etc.
Most of yii beginner write parameter in main.php because thats pattern comes in installed yii
framework. This is fine if you have less parameter but if you are building large web portal or
application then it's very hard to manage every thing in mail.php because its main config file. So
the best way is create seperate params.php in the same directory and include it in you main.php
file. Check is below example of params.php and main.php files.
config/main.php :
'params'=>require(dirname(__FILE__).'/params.php'),

config/params.php :
<?php
return array(
'defaultPageSize'=>10,
'websiteName'=>'ezeelive.com',
'copyrightInfo'=>'Copyright &copy; '.date("Y").' Ezeelive Technologies. All Rights Reserved.',
...
);
?>

Written By : Ezeelive Technologies

More Related Content

Create custom params file in yii framework

  • 1. Create custom params file in yii framework Yii framework is come with powerful inbuild features eg. 1. Model-View-Controller (MVC) design pattern 2. Database Access Objects (DAO) 3. Custom Query Builder, Active Record (AR) and DB Migration 4. Form input and validation 5. AJAX-enabled widgets 6. Authentication and authorization 7. Layout Skinning and theming 8. Web services 9. Internationalization (I18N) and localization (L10N) 10. Layered caching scheme 11. Error handling and logging 12. Security 13. Unit and functionality testing 14. Automatic code generation (Gii Module) 15. Friendly with third-party code 16. Detailed documentation 17. Extension library etc. Most of yii beginner write parameter in main.php because thats pattern comes in installed yii framework. This is fine if you have less parameter but if you are building large web portal or application then it's very hard to manage every thing in mail.php because its main config file. So the best way is create seperate params.php in the same directory and include it in you main.php
  • 2. file. Check is below example of params.php and main.php files. config/main.php : 'params'=>require(dirname(__FILE__).'/params.php'), config/params.php : <?php return array( 'defaultPageSize'=>10, 'websiteName'=>'ezeelive.com', 'copyrightInfo'=>'Copyright &copy; '.date("Y").' Ezeelive Technologies. All Rights Reserved.', ... ); ?> Written By : Ezeelive Technologies