Download the PHP package geerthauwaerts/now-env without Composer

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

PHP NowEnv

Load the now.json variables into your development environment.

With the help of this package, you can easily use your Now environment variables for the use in development.

If you're already using a now.json file, the env sub property will be assigned to $_ENV, $_SERVER, and getenv() automatically.

This package does absolutely nothing when running in a Now instance.

Build Status

Installation

Use composer to add the library:

Usage

Add the env property to your now.json file and load the variables in your application with:

Optionally you can pass in a filename as the second parameter, if you would like to use something other than now.json.

All of the defined variables are now accessible with the getenv method, and are available in the $_ENV and $_SERVER super-globals.

Immutability

By default, NowEnv will NOT overwrite existing environment variables that are already set in the environment.

If you want NowEnv to overwrite existing environment variables, use overload() instead of load():

Requiring variables to be set

You can require specific environment variables to be defined by passing a single string:

Or an array of strings:

If any environment variables vars are missing, NowEnv will throw a RuntimeException like this:

Empty variables

Beyond simply requiring a variable to be set, you might also need to ensure the variable is not empty:

If the environment variable is empty, you'd get an Exception:

Integer variables

You might also need to ensure that the variable is of an integer value. You may do the following:

If the environment variable is not an integer, you'd get an Exception:

Boolean variables

You may need to ensure a variable is in the form of a boolean. You may do the following:

If the environment variable is not a boolean, you'd get an Exception:

Allowed Values

It is also possible to define a set of values that your environment variable should be. This is especially useful in situations where only a handful of options or drivers are actually supported by your code:

If the environment variable wasn't in this list of allowed values, you'd get a similar Exception:

Collaboration

The GitHub repository is used to keep track of all the bugs and feature requests; I prefer to work exclusively via GitHib and Twitter.

If you have a patch to contribute:

Shout to @GeertHauwaerts on Twitter at any time :)

Donations

If you like this project and you want to support the development, please consider to donate; all donations are greatly appreciated.


All versions of now-env with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 geerthauwaerts/now-env contains the following files

Loading the files please wait ....