1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* src/SecurityTxtServiceProvider.php. |
4
|
|
|
* |
5
|
|
|
* @author Austin Heap <[email protected]> |
6
|
|
|
* @version v0.4.0 |
7
|
|
|
*/ |
8
|
|
|
declare(strict_types=1); |
9
|
|
|
|
10
|
|
|
namespace AustinHeap\Security\Txt; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* SecurityTxtServiceProvider. |
14
|
|
|
* |
15
|
|
|
* @link https://github.com/austinheap/laravel-security-txt |
16
|
|
|
* @link https://packagist.org/packages/austinheap/laravel-security-txt |
17
|
|
|
* @link https://austinheap.github.io/laravel-security-txt/classes/AustinHeap.Security.Txt.SecurityTxtServiceProvider.html |
18
|
|
|
* @link https://securitytext.org/ |
19
|
|
|
*/ |
20
|
|
|
class SecurityTxtServiceProvider extends \Illuminate\Support\ServiceProvider |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* Indicates if loading of the provider is deferred. |
24
|
|
|
* |
25
|
|
|
* @var bool |
26
|
|
|
*/ |
27
|
|
|
protected $defer = false; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Perform post-registration booting of services. |
31
|
|
|
* |
32
|
|
|
* @return void |
33
|
|
|
*/ |
34
|
54 |
|
public function boot() |
35
|
|
|
{ |
36
|
54 |
|
$this->publishes([ |
37
|
54 |
|
__DIR__.'/config/security-txt.php' => config_path('security-txt.php'), |
38
|
|
|
]); |
39
|
|
|
|
40
|
54 |
|
if (! $this->app->routesAreCached()) { |
41
|
54 |
|
require __DIR__.'/routes/security-txt.php'; |
42
|
|
|
} |
43
|
|
|
|
44
|
54 |
|
if (! defined('LARAVEL_SECURITY_TXT_VERSION')) { |
45
|
1 |
|
define('LARAVEL_SECURITY_TXT_VERSION', SecurityTxtHelper::VERSION); |
46
|
|
|
} |
47
|
54 |
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Register the service provider. |
51
|
|
|
* |
52
|
|
|
* @return void |
53
|
|
|
*/ |
54
|
54 |
|
public function register() |
55
|
|
|
{ |
56
|
54 |
|
$this->mergeConfigFrom( |
57
|
54 |
|
__DIR__.'/config/security-txt.php', 'security-txt' |
58
|
|
|
); |
59
|
|
|
|
60
|
54 |
|
$this->app->singleton('SecurityTxt', function () { |
61
|
24 |
|
return new SecurityTxtHelper; |
62
|
54 |
|
}); |
63
|
54 |
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return \AustinHeap\Security\Txt\SecurityTxtHelper |
67
|
|
|
*/ |
68
|
2 |
|
public static function getInstance() |
69
|
|
|
{ |
70
|
2 |
|
return app('SecurityTxt'); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|