Download the PHP package machaven/laravel-cascading-config without Composer

On this page you can find all versions of the php package machaven/laravel-cascading-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-cascading-config

Laravel 5 Cascading Config Files

Why? - The .env problem

When continously developing and extending a laravel application, you may find that your .env file becomes large and hard to maintain. When multiple branches with .env changes are deployed, it becomes a nightmare to consolidate all the .env changes and update the live .env file.

This forced me to rethink configuration and what is truly important inside an .env file.

What to keep in your .env file

What to take out of your .env file

Why use cascading config files?

  1. Cascading configuration files allow you to keep a set of config files for every environment. All environment configs override the base configs in the config folder. This allows you to setup a dynamic config for each environment.

  2. Settings changes can be recorded on pull requests. This prevents settings changes from being lost when only changed on the server .env file.

Furthermore if you use the env() function in your config files, it will allow you to override any defaults in the config file with variables from the .env file if they exist.

Install

Install the package through composer

After installing, add the ServiceProvider to the providers array in app/config/app.php (not required for laravel 5.5+)

How this works

The service provider will check if the directory exists for the environment configured in your .env file. If the environment folder exists, then all configuration files will be read from it and merged over the configurations from the config folder.

Example for cascading config files

Firstly, create your default config file in the standard laravel config/ folder.

Now create a folder to override the example config for an environment. A folder can be created for any environment defined in your APP_ENV. In this example, we use local:

Now create another example config in the local folder:

Example config file contents

config/example.php

config/local/example.php

In the local configuration above, we are not overriding the curlTimeout array key.

Example config results

When APP_ENV is local:

When APP_ENV is prod:

As you can see, the above file is not overridden by the one in the config/local/ folder.

When APP_ENV is prod and TEST='ENV FILE' is added to .env file:

The test key is overridden here by the TEST variable in the .env file. This is because we are using the env() helper in our config files to override settings for any environment; if they exit in the .env.


All versions of laravel-cascading-config with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package machaven/laravel-cascading-config contains the following files

Loading the files please wait ....