2017 © Pedro Peláez
 

library silex-darklaunch-provider

Dark launch provider bundle for Silex2

image

exs/silex-darklaunch-provider

Dark launch provider bundle for Silex2

  • Thursday, August 13, 2015
  • by rumpranger
  • Repository
  • 8 Watchers
  • 0 Stars
  • 393 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

EXS-silex-darklaunch-provider

Provides darklaunch ability based on user ips., (*1)

Installing the EXS-silex-darklaunch-provider in a Silex project

The installation process is actually very simple. Set up a Silex project with Composer., (*2)

Once the new project is set up, open the composer.json file and add the exs/silex-darklaunch-provider as a dependency: ``` js //composer.json //... "require": { //other bundles "exs/silex-darklaunch-provider": "@dev", (*3)

Or you could just add it via the command line:

$ composer.phar require exs/silex-darklaunch-provider ~1.0@dev, (*4)


Save the file and have composer update the project via the command line: ``` shell php composer.phar update

Composer will now update all dependencies and you should see our bundle in the list: ``` shell - Installing exs/silex-darklaunch-provider (dev-master 463eb20) Cloning 463eb2081e7205e7556f6f65224c6ba9631e070a, (*5)


Update the app.php to include the EXS-silex-darklaunch-provider provider: ``` php //app.php //... $app->register(new \EXS\DarklaunchProvider\Providers\Services\DarklaunchProvider());

Add ips to active dark launched functions or services in config.php:, (*6)

//...
$app['exs.active.ips'] = array(
    '127.0.0.1',
    MORE IPS HERE
);
//...

USAGE

Declare the service, (*7)

//...
use EXS\DarklaunchProvider\Services\DarklaunchService;

$darkLauncher = new DarklaunchService(ARRAY_OF_ACTIVE_IPS);
//...

// or inject the service in your service provider

//...
use Pimple\ServiceProviderInterface;
use Pimple\Container;

class YourServiceProvider implements ServiceProviderInterface
{
    public function register(Container $container)
    {
        $container[YOUR_SERVICE_PROVIDER_NAME] = ( function ($container) {
            return new YOUR_SERVICE_PROVIDER_LOCATION($container['exs.serv.darklaunch']);
        });                
    }
}

// in your service constructor
public function __construct(DarklaunchService $darklaunchService)
{              
    $this->darklaunchService = $darklaunchService;
}
//...

Wrap the function or service to be dark launched and triggered by ip, (*8)

//...
if($darkLauncher->isActiveIp()) {
    FUNCTION_TO_BE_DARKLAUNCHED
}

// or if you already know the user ip

if($darkLauncher->isActiveIp(USER_IP_HERE)) {
    FUNCTION_TO_BE_DARKLAUNCHED
}
//...

Contributing

Anyone and everyone is welcome to contribute., (*9)

If you have any questions or suggestions please [let us know][1]., (*10)

The Versions

13/08 2015

dev-master

9999999-dev https://github.com/ExSituMarketing/EXS-silex-darklaunch-provider

Dark launch provider bundle for Silex2

  Sources   Download

MIT

The Requires

 

by slee

silex provider darklaunch