Skip to content

Commit dc39431

Browse files
author
Andrey Helldar
committed
Added a facade for defining the type of framework
1 parent 9ab975a commit dc39431

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Diff for: src/Facades/App.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Helldar\LaravelSupport\Facades;
4+
5+
use Helldar\LaravelSupport\Support\App as Support;
6+
use Illuminate\Support\Facades\Facade;
7+
8+
/**
9+
* @method static bool isLaravel()
10+
* @method static bool isLumen()
11+
*/
12+
final class App extends Facade
13+
{
14+
protected static function getFacadeAccessor()
15+
{
16+
return Support::class;
17+
}
18+
}

Diff for: src/Support/App.php

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Helldar\LaravelSupport\Support;
4+
5+
use Illuminate\Foundation\Application as LaravelApp;
6+
use Laravel\Lumen\Application as LumenApp;
7+
8+
final class App
9+
{
10+
public function isLaravel(): bool
11+
{
12+
return class_exists(LaravelApp::class);
13+
}
14+
15+
public function isLumen(): bool
16+
{
17+
return class_exists(LumenApp::class);
18+
}
19+
}

0 commit comments

Comments
 (0)