Download the PHP package zvps/laravel-4-env-polyfill without Composer

On this page you can find all versions of the php package zvps/laravel-4-env-polyfill. 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-4-env-polyfill

Laravel 4 Env Polyfill

Laravel 5 has a nice function env() which can assign a default variable if empty/null/blank.

Laravel 4 applications are generally missing this functionality and if not running on >= PHP 7.0 can't use the ?? notation to keep (isset($_ENV(thing))) ? $_ENV(thing) : default short and sweet e.g $_ENV(thing) ?? default.

Installation

composer require zvps/laravel-4-env-polyfill

Setup

Make sure to start using the detectEnvironment functionality inside boostrap/start.php so .env.local.php for example are available and selected correctly.

$env = $app->detectEnvironment(array(
  'local' => array('your-machine-name'),
));

Next setup .env files and a .env.example.php so required defaults are documented.

.env.local.php

<?php
return array(
  'DATABASE_NAME' => 'my_database',
  'DATABASE_USER' => 'username',
  'DATABASE_PASSWORD' => 'totally_secure_password'
);

Next update all files in app/config/*.php with the env() polyfill:

Without polyfill:

'host'      => if(isset($_ENV['DATABASEHOST']) ? $_ENV['DATABASE_HOST'] : 'localhost',
'database'  => if(isset($_ENV['DATABASE_NAME']) ? $_ENV['DATABASE_NAME'] : 'default_db',
'username'  => if(isset($_ENV['DATABASE_USERNAME']) ? $_ENV['DATABASE_USERNAME'] : 'default_user',
'password'  => if(isset($_ENV['DATABASE_PASSWORD']) ? $_ENV['DATABASE_PASSWORD'] : 'default_pass',

With polyfill:

'host'      => env('DATABASE_HOST', 'localhost')
'database'  => env('DATABASE_NAME', 'default_db'),
'username'  => env('DATABASE_USER', 'default_user'),
'password'  => env('DATABASE_PASSWORD', 'default_pass')

All versions of laravel-4-env-polyfill with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version 4.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 zvps/laravel-4-env-polyfill contains the following files

Loading the files please wait ....