Download the PHP package etelford/phpdotenv-include-extension without Composer

On this page you can find all versions of the php package etelford/phpdotenv-include-extension. 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 phpdotenv-include-extension

PHP dotenv extension for vlucas/phpdotenv to load .env variables from include files. Build Status

How & Why?

This package works as an add-on to the great vlucas/phpdotenv. When .env files start to get large it could be convenient to separate variables out into smaller pieces. This helps solve that problem.

NB: If you're new to the idea of a .env file, I recommend you start by checking out vlucas/phpdotenv first.

Installation

composer.json:

"require": {
    "etelford/phpdotenv-include-extension": "0.1.*"
}

Example

Create your .env file as usual, but where you want to separate out sections of it, use an include.

When you want to retrieve an env variable from an include file, create an instance of Etelford\Dotenv and then retrieve the variables using whichever method you normally use to include environment variables:

As you can see, the variables in an include file become namespaced. In the example above, .database.env is included by using a namespace (DATABASE) followed by and underscore (_) and the word INCLUDE.

Using With Laravel 5.x

If you'd like to use this with the Laravel framework, open your bootstrap/app.php and add the following after the application is initially created:

That's it! Now you can use included .env files as much as you like.

Conventions

  1. The path of an include is always relative to your root .env file.
  2. You declare that a variable points to an include file using the _INCLUDE keyword. If you wish to override this you can with the third argument when you create the Dotenv class: $dotenv = new Etelford\Dotenv(__DIR__, '.env', 'PATH'); Note that the _ should not be provided if you use this customization.

Caveat

This package will not work as a command line script.


All versions of phpdotenv-include-extension with dependencies

PHP Build Version
Package Version
Requires php Version ^5.4 || ^7.0
vlucas/phpdotenv Version ~2.2
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 etelford/phpdotenv-include-extension contains the following files

Loading the files please wait ....