Skip to content

Commit 1d6bcd2

Browse files
committed
Consistently rename config and headers to 'NativePHP'
1 parent 3f17006 commit 1d6bcd2

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ composer require nativephp/laravel
1818
You can publish and run the migrations with:
1919

2020
```bash
21-
php artisan vendor:publish --tag="native-php-migrations"
21+
php artisan vendor:publish --tag="nativephp-migrations"
2222
php artisan migrate
2323
```
2424

2525
You can publish the native app provider using
2626

2727
```bash
28-
php artisan vendor:publish --tag="native-php-provider"
28+
php artisan vendor:publish --tag="nativephp-provider"
2929
```
3030

3131
## Testing
File renamed without changes.

src/Client/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ class Client
1313
public function __construct()
1414
{
1515
$this->client = Http::asJson()
16-
->baseUrl(config('native-php.api_url', ''))
16+
->baseUrl(config('nativephp.api_url', ''))
1717
->timeout(60 * 60)
1818
->withHeaders([
19-
'X-Native-PHP-Secret' => config('native-php.secret'),
19+
'X-NativePHP-Secret' => config('nativephp.secret'),
2020
])
2121
->asJson();
2222
}

src/Commands/LoadStartupConfigurationCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ class LoadStartupConfigurationCommand extends Command
1111

1212
public function handle()
1313
{
14-
echo json_encode(config('native-php'));
14+
echo json_encode(config('nativephp'));
1515
}
1616
}

src/Http/Controllers/NativeAppBootedController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class NativeAppBootedController
99
{
1010
public function __invoke(Request $request)
1111
{
12-
$provider = app(config('native-php.provider'));
12+
$provider = app(config('nativephp.provider'));
1313
$provider->boot();
1414

1515
event(new ApplicationBooted());

src/Http/Middleware/PreventRegularBrowserAccess.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ class PreventRegularBrowserAccess
1010
public function handle(Request $request, Closure $next)
1111
{
1212
$cookie = $request->cookie('_php_native');
13-
$header = $request->header('X-Native-PHP-Secret');
13+
$header = $request->header('X-NativePHP-Secret');
1414

15-
if ($cookie && $cookie === config('native-php.secret')) {
15+
if ($cookie && $cookie === config('nativephp.secret')) {
1616
return $next($request);
1717
}
1818

19-
if ($header && $header === config('native-php.secret')) {
19+
if ($header && $header === config('nativephp.secret')) {
2020
return $next($request);
2121
}
2222

src/NativeServiceProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class NativeServiceProvider extends PackageServiceProvider
2323
public function configurePackage(Package $package): void
2424
{
2525
$package
26-
->name('native-php')
26+
->name('nativephp')
2727
->hasCommands([
2828
MinifyApplicationCommand::class,
2929
LoadStartupConfigurationCommand::class,
@@ -39,7 +39,7 @@ public function packageRegistered()
3939
ServeCommand::$passthroughVariables[] = $env;
4040
}
4141

42-
if (config('native-php.running')) {
42+
if (config('nativephp.running')) {
4343
$this->configureApp();
4444
}
4545
}
@@ -48,22 +48,22 @@ protected function configureApp()
4848
{
4949
$oldStoragePath = $this->app->storagePath();
5050

51-
$this->app->useStoragePath(config('native-php.storage_path'));
51+
$this->app->useStoragePath(config('nativephp.storage_path'));
5252

5353
// Patch all config values that contain the old storage path
5454
$config = Arr::dot(config()->all());
5555

5656
foreach ($config as $key => $value) {
5757
if (is_string($value) && str_contains($value, $oldStoragePath)) {
58-
$newValue = str_replace($oldStoragePath, config('native-php.storage_path'), $value);
58+
$newValue = str_replace($oldStoragePath, config('nativephp.storage_path'), $value);
5959
config([$key => $newValue]);
6060
}
6161
}
6262

6363
config(['database.connections.nativephp' => [
6464
'driver' => 'sqlite',
6565
'url' => env('DATABASE_URL'),
66-
'database' => config('native-php.database_path'),
66+
'database' => config('nativephp.database_path'),
6767
'prefix' => '',
6868
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
6969
]]);

0 commit comments

Comments
 (0)