Download the PHP package sebastiansulinski/dotenv without Composer

On this page you can find all versions of the php package sebastiansulinski/dotenv. 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 dotenv

DotEnv

Package which enables to load environment variables from multiple .env files at multiple locations

This package is a work that derived from package published by vlucas/phpdotenv with some additional functionality such as handling multiple .env files and setting up variables using instance of the class.

Build Status

Installation

Install package using composer

Usage instructions

To use the plugin you'll need to have at least one .env file i.e.

You load all your .env files when instantiating the SSD\DotEnv\DotEnv object.

You can pass a single .env file, path to a directory with .env.* files or multiple paths / directories

Loading variables

To load process the variables there are two methods load() and overload().

The load() method will only set the variables that do not already exist, while overload() will set them all - overwriting any existing ones.

Required variables

To ensure that your system has all necessary variables available you can use required() method, which takes either a single variable name or an array of required variables.

If any of the required variables does not exist in any of the .env.*files - system will throw a RuntimeException.

Returning contents of .env file(s) as array

Use toArray() method to fetch the contents of the .env file(s), with or without setting up the environment variables.

Obtaining value stored in the variable

You can use a static get() method on the DotEnv object to retrieve the value stored in a given environment variable.

When you associate the string true, false with the variables within your .env file, they will automatically be converted to boolean true / false when using DotEnv::get. The same applies to the variable with null string, which will return null value.

If you specify a variable without any value associated (MY_VARIABLE=) - it will return an empty string ''.

You can provide a second argument to the get() method, which will be returned if variable was not found. The default value can be of a scalar or a Closure type.

Checking if exists and equals

You can check if variable exists by using has() and whether it stores a given value by using is() methods.

Setting variables

Variable referencing

If there is a variable that you'd like to inherit the value of you can use its name wrapped within the ${..} i.e.


All versions of dotenv with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 || ^8.0
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 sebastiansulinski/dotenv contains the following files

Loading the files please wait ....