From 1e02d37137e2597065352ae123086665415080fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CA=BFAhed=20=CA=BFid?= Date: Fri, 10 Nov 2017 09:38:05 +0200 Subject: [PATCH 1/2] fix "failed to open required file" for config file This will fix "failed to open required file" When we use this package (with laravel) inside phar archive. The problem happen because realpath will return the full path when the package no longer exist in disk. With this pull request the path will be relative and will work inside phar archive. --- src/TrustedProxyServiceProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TrustedProxyServiceProvider.php b/src/TrustedProxyServiceProvider.php index dc299e3..e2ee9a0 100644 --- a/src/TrustedProxyServiceProvider.php +++ b/src/TrustedProxyServiceProvider.php @@ -15,10 +15,10 @@ class TrustedProxyServiceProvider extends ServiceProvider */ public function boot() { - $source = realpath(__DIR__.'/../config/trustedproxy.php'); + $source = __DIR__.'/../config/trustedproxy.php'; if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { - $this->publishes([$source => config_path('trustedproxy.php')]); + $this->publishes([realpath($source) => config_path('trustedproxy.php')]); } elseif ($this->app instanceof LumenApplication) { $this->app->configure('trustedproxy'); } From f3d769cc923dd3ec15ac42875ab37f1bc1968e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CA=BFAhed=20=CA=BFid?= Date: Fri, 10 Nov 2017 10:04:04 +0200 Subject: [PATCH 2/2] fix "artisan vendor:publish" with phar archive --- src/TrustedProxyServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TrustedProxyServiceProvider.php b/src/TrustedProxyServiceProvider.php index e2ee9a0..e883aaf 100644 --- a/src/TrustedProxyServiceProvider.php +++ b/src/TrustedProxyServiceProvider.php @@ -18,7 +18,7 @@ public function boot() $source = __DIR__.'/../config/trustedproxy.php'; if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { - $this->publishes([realpath($source) => config_path('trustedproxy.php')]); + $this->publishes([$source => config_path('trustedproxy.php')]); } elseif ($this->app instanceof LumenApplication) { $this->app->configure('trustedproxy'); }