2017 © Pedro Peláez
 

library eloquent-scientist

Allow the Scientist library to be used with the Laravel PHP framework.

image

jampot5000/eloquent-scientist

Allow the Scientist library to be used with the Laravel PHP framework.

  • Tuesday, September 20, 2016
  • by jampot5000
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Eloquent Scientist

Allows the Scientist library to be used with the Laravel PHP framework, and adds the migrations/models for storing the resulting information with eloquent., (*1)

Installation

Require the latest version of Eloquent Scientist using Composer., (*2)

composer require jampot5000/eloquent-scientist

Next, add the service provider to the providers section of config/app.php in your Laravel project., (*3)

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Autoloaded Service Providers
    |--------------------------------------------------------------------------
    |
    | The service providers listed here will be automatically loaded on the
    | request to your application. Feel free to add your own services to
    | this array to grant expanded functionality to your applications.
    |
    */

    'providers' => [

        /*
         * Application Service Providers...
         */
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,

        Jampot5000\EloquentScientist\ServiceProvider::class,

    ],

];

Register the Facade within the aliases section of config/app.php., (*4)

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Class Aliases
    |--------------------------------------------------------------------------
    |
    | This array of class aliases will be registered when this application
    | is started. However, feel free to register as many as you wish as
    | the aliases are "lazy" loaded so they don't hinder performance.
    |
    */

    'aliases' => [

        'URL'       => Illuminate\Support\Facades\URL::class,
        'Validator' => Illuminate\Support\Facades\Validator::class,
        'View'      => Illuminate\Support\Facades\View::class,

        'Scientist' => Jampot5000\EloquentScientist\Facade::class,

    ],

];

Run the migrations, (*5)

php artisan migrate

You're good to go!, (*6)

Optional

You can publish the configuration file, (*7)

    php artisan vendor:publish

This will allow you to configure the models used and add additional reporters, (*8)

Usage

You can access the Eloquent Scientist Laboratory through the Scientist facade., (*9)

<?php

$value = Scientist::experiment('foo')
    ->control($controlCallback)
    ->trial('First trial.', $trialCallback)
    ->run();

Or, inject the Laboratory into a container resolved class or controller action., (*10)

<?php

use Scientist\Laboratory;

class FooController extends Controller
{
    public function index(Laboratory $laboratory)
    {
        return $laboratory->experiment('foo')
            ->control(function() { ... })
            ->trial('First trial.', function() { ... })
            ->run();
    }
}

See the Scientist documentation for more information!, (*11)

Credit

Dayle Rees - For porting the Scientist Library to PHP, and for the original laravel package this idea came from., (*12)

Todo

  • [ ] Tests
  • [ ] Views

The Versions

20/09 2016

dev-master

9999999-dev

Allow the Scientist library to be used with the Laravel PHP framework.

  Sources   Download

MIT

The Requires

 

by Jamie Holcroft

laravel testing experiment scientist

20/09 2016

v1.0.0

1.0.0.0

Allow the Scientist library to be used with the Laravel PHP framework.

  Sources   Download

MIT

The Requires

 

by Jamie Holcroft

laravel testing experiment scientist