2017 © Pedro Peláez
 

project envswitch

Code once, host anywhere, run everywhere

image

kimtooflex/envswitch

Code once, host anywhere, run everywhere

  • Friday, August 25, 2017
  • by kimtooflex
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

envswitch.php

Code once, host anywhere, run everywhere, (*1)

envswitch.php is a fast & flexible environment switching library for PHP 5.X+, (*2)

  • Define multiple production or development servers
  • Callback compatibility
  • No Server limits

Getting started

  1. PHP 5.x.x is required
  2. Install envswitch using Composer (recommended)

Composer Installation

  1. Get Composer
  2. Require Klein with php composer.phar require kimtooflex/envswitch
  3. Add the following to your application's main PHP file: use \envswitch\EnvSwitch;

Example

Hello World - Obligatory hello world example (one server), (*3)

<?php
 use \envswitch\EnvSwitch;

EnvSwitch::setEnv("127.0.0.2",
          function() {
              die("Hello world, this is development environment");
          },
          function() {
               die("Hello world, this is production environment");
          }
);

Example 1 - Respond to many servers, (*4)

<?php
use \envswitch\EnvSwitch;

EnvSwitch::setEnv("127.0.0.2,localhost",
          function() {
              die("Hello world, this is development environment");
          },
          function() {
               die("Hello world, this is production environment");
          }
);

The Versions

25/08 2017

dev-master

9999999-dev

Code once, host anywhere, run everywhere

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by kipngetich kimutai

template composer switch environment package kimtooflex bunifu