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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ EXPOSE 80

VOLUME ["/app/storage/logs", "/var/log/nginx", "/var/log/php"]

WORKDIR /app
WORKDIR /app
20 changes: 20 additions & 0 deletions app/Http/Controllers/ExampleFeatureFlagsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
declare(strict_types = 1);

namespace App\Http\Controllers;

use Abrouter\Client\Client;

class ExampleFeatureFlagsController
{
public function __invoke(Client $client)
{
$enabledButtonFeatureFlag = $client->featureFlags()->run('enabled_button_feature_flag');
$disabledButtonFeatureFlag = $client->featureFlags()->run('disabled_button_feature_flag');

return view('featureFlags', [
'enabledButtonFeatureFlag' => $enabledButtonFeatureFlag,
'disabledButtonFeatureFlag' => $disabledButtonFeatureFlag,
]);
}
}
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"license": "MIT",
"require": {
"php": "^8.0",
"abrouter/abrouter-laravel-bridge": "^0.6",
"abrouter/abrouter-php-client": "0.4.0",
"abrouter/abrouter-laravel-bridge": "^0.11",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.54",
Expand Down
42 changes: 21 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docker/provision/after-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ rm -rf \
/usr/lib/php/20131226 \
/entypoint.sh

mkdir -p /var/cache/nginx/

find /var/log -type f | while read f; do
echo -ne '' > ${f} 2&>1 > /dev/null || true;
done
Expand Down
Binary file added public/imgs/controller.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/imgs/template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/views/button.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@

<button style="background: {{$color}}; padding: 10px; border-radius: 3px; margin-left: 20%;">Hello</button>

<br/>
<a href="/feature-flags">Check the feature flags <example></example></a>

</body>
</html>
55 changes: 55 additions & 0 deletions resources/views/featureFlags.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Laravel Test page</title>
</head>
<body>

<div>Hello. It's a ABRouter feature flags example. </div>
<br/>
@if ($enabledButtonFeatureFlag)
<button>This button is showing</button>
@endif
<br/>
<br/>

And the next button is not showing.
<br/>
<br/>


@if ($disabledButtonFeatureFlag)
<button>This button is not showing</button>
@endif
Let's inspect the code to understand how it works:

<br/>
<br/>
<br/>
Controller:
<br/>

<img src="/imgs/controller.png" width="50%"/>

<br/>
<br/>
<br/>
And the part of template:
<br/>

<img src="/imgs/template.png" width="50%"/>

<br/>
<br/>
<br/>
<div style="width: auto; margin-left:47%;"><a href="/">Back to the main page</a>
</div>
<br/>
<br/>
<br/>



</body>
</html>
3 changes: 3 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use App\Http\Controllers\ExampleController;
use App\Http\Controllers\ExampleFeatureFlagsController;
use Illuminate\Support\Facades\Route;

/*
Expand All @@ -15,3 +16,5 @@
*/

Route::get('/', ExampleController::class);
Route::get('/feature-flags', ExampleFeatureFlagsController::class);