Download the PHP package prinx/dotenv without Composer

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

PHP Dotenv

[![tests](https://github.com/prinx/dotenv/actions/workflows/tests.yml/badge.svg)](https://github.com/prinx/dotenv/actions/workflows/tests.yml) [![codecov](https://codecov.io/gh/prinx/dotenv/branch/main/graph/badge.svg?token=ZLK6TQXEDQ)](https://codecov.io/gh/prinx/dotenv)

Get easily access to environment variables.

Installation

Open a command prompt into your project root folder and run:

Usage

Quick start

Writing a .env file

The .env file format will be:

For example:

As standard, the variable name is capital letter with underscores to separate words.

Comments

You can write comments in your .env file by preceding the comment by a hash (#). Example:

Types of values

By default, env variable will be retrieved as string, except booleans, and null.

String

You can use quotes to surround strings.

Boolean

The values true, "true" or 'true', will be got as the boolean true. The values false, "false" or 'false' will be got as the boolean false.

Same as:

Null

The values null, "null" or 'null', will be got as null.

Referring to another variable

You can refer to the value of another variable in your .env file by putting the name of the variable you are referring to variable inside ${}:

Loading a specific .env file

By default, the package automatically look for the .env file in the project root folder. But you can load the env file from anywhere by using the loadenv function:

Using the Dotenv instance

You can also get or set a variable using the Dotenv class instance:

The Dotenv instance can be accessed by calling the dotenv() function:

Getting a variable

Getting all variables

Adding a variable to the current loaded environment

Writing a variable to the .env file

Create your own Dotenv instance

You can create your own Dotenv instance just by using the Dotenv class:

Contributing

License

MIT


All versions of dotenv with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.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 prinx/dotenv contains the following files

Loading the files please wait ....