FuelPHP custom environments -
i'm moving existing fuelphp application across new environment, , i've reached point adding environment beyond default 4 (ie. development, test, stage, production), in use elsewhere.
is there reasonably straightforward way of adding environment fuelphp? if there is, i'd appreciate guidance on how it.
yes possible not documented , here hacked approach found after looking @ posting
below steps create custom environment in fuel php application
for example need call new environment 'experiment'
1 . create folder called experiment inside fuel/app/config directory
2 . create db.php file inside fuel/app/config/experiment directory below contents can add other config below default db configurations ( change according platform ) other migration files copied folder other environment
return array( 'default' => array( 'connection' => array( 'dsn' => 'mysql:host=localhost;dbname=yourappdatabasename', 'username' => 'yourdbuname', 'password' => 'yourdbpassword', ), ), );
3 . next change env name inside fuel/app/bootstrap.php file
fuel::$env = (isset($_server['fuel_env']) ? $_server['fuel_env'] : fuel::experiment);
4 . open fuel/core/classes/fuel.php file , add new constant fuel class below @ top of class , think find other environments declared there .
const experiment = 'experiment';
and that's have created new custom environment in fuel php application ,
note : - approach hacked approach not officially documented
posting here hoping may or others similar requirements
edit : - versions > 1.5
step 1 , step 2 same
3 . (assuming you're using apache) set fuel_env server variable new environment name adding following line virtualhost configuration:
setenv fuel_env experiment
that's there (on apache, anyway). no need add const core/fuel.php (as per pre-defined environments). unnecessary , make difficult upgrade fuel's core.
Comments
Post a Comment