Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .env.example → .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
CACHE_DRIVER=redis
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
QUEUE_CONNECTION=redis
QUEUE_DRIVER=redis
REDIS_HOST=redis

SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN unzip /usr/bin/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip

RUN mkdir -p /entrypoint.d \
&& cp -R /app/docker/provision/entrypoint.d/* /entrypoint.d/ \
# && cp -R /app/docker/config/supervisor/conf.d/* /opt/docker/etc/supervisor.d/ \
&& cp -R /app/docker/supervisor/* /opt/docker/etc/supervisor.d/ \
&& mkdir -p /opt/docker/etc/php/7.1/conf.d \
&& cp /app/docker/config/php/app.ini /opt/docker/etc/php/7.1/conf.d/app.ini \
&& cp /app/docker/config/nginx/sites-enabled/app1.conf /opt/docker/etc/nginx/vhost.conf \
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Then, run the following commands:

``` bash
$ git clone https://github.com/abrouter/laravel-example.git
$ cp .env.dist .env
$ composer install
$ docker-compose up -d
```
Expand All @@ -21,4 +22,4 @@ Color of the button will changing every time by the following spread:
33% - green

## Ready to use ABRouter on your own project ?
Let's go on [ABRouter](https://abrouter.com) and start.
Let's go on [ABRouter](https://abrouter.com) and start.
22 changes: 18 additions & 4 deletions app/Http/Controllers/ExampleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,28 @@
namespace App\Http\Controllers;

use Abrouter\Client\Client;
use Abrouter\Client\DTO\EventDTO;

class ExampleController
{
public function __invoke(Client $client)
{
$buttonColor = $client->experiments()->run(uniqid(), 'D1D06000-0000-0000-00005030');
return view('button', [
'color' => $buttonColor->getBranchId(),
]);
try {
$userId = uniqid();
$buttonColor = $client->experiments()->run($userId, 'button_color');
$client->statistics()->sendEvent(new EventDTO(
null,
$userId,
'visited_test_page'
));

return view('button', [
'color' => $buttonColor->getBranchId(),
'parallelRunning' => config('abrouter.parallelRunning.enabled') === true,
]);
} catch (\Exception $e) {
die(var_dump($e->getMessage()));
}

}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"require": {
"php": "^8.0",
"abrouter/abrouter-laravel-bridge": "^0.11",
"abrouter/laravel-abtest": "0.13.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.54",
Expand Down
Loading