joetjen.net
EN DE
← All libraries
PHP

php-cooper-laravel

The Laravel integration of Cooper: a CASC document fills the configuration repository in place of config/*.php, Cooper reads the .env files, and cooper:import moves existing config files over.

Intention

Code that reads configuration does not change — config('app.name'), Config::get() and every package work as before, the framework’s defaults still sit underneath, and config:cache keeps working. Nothing is patched automatically: every installation step is one you make yourself and can see in your diff.

Example
#@version = 1.0
# config/config.casc

app {
  name  = ${APP_NAME:"Laravel"}
  debug = !bool(${APP_DEBUG:false})
}

database {
  default = ${DB_CONNECTION:"mysql"}
  connections.mysql.host = ${DB_HOST:"127.0.0.1"}
}
Install
composer require joetjen/cooper-laravel
LaravelConfiguration