From 430fe14e88accad7e0c2c47914e596308d22e178 Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Mon, 31 Jul 2023 22:33:22 +0200 Subject: [PATCH] Allow custom php.ini settings --- .../stubs/NativeAppServiceProvider.php.stub | 53 ++++--------------- src/Commands/LoadPHPConfigurationCommand.php | 22 ++++++++ src/Contracts/ProvidesPhpIni.php | 8 +++ src/NativeServiceProvider.php | 2 + 4 files changed, 43 insertions(+), 42 deletions(-) create mode 100644 src/Commands/LoadPHPConfigurationCommand.php create mode 100644 src/Contracts/ProvidesPhpIni.php diff --git a/resources/stubs/NativeAppServiceProvider.php.stub b/resources/stubs/NativeAppServiceProvider.php.stub index a1636cb..6baa542 100644 --- a/resources/stubs/NativeAppServiceProvider.php.stub +++ b/resources/stubs/NativeAppServiceProvider.php.stub @@ -2,13 +2,10 @@ namespace App\Providers; -use Native\Laravel\Facades\ContextMenu; -use Native\Laravel\Facades\Dock; use Native\Laravel\Facades\Window; -use Native\Laravel\Facades\GlobalShortcut; -use Native\Laravel\Menu\Menu; +use Native\Laravel\Contracts\ProvidesPhpIni; -class NativeAppServiceProvider +class NativeAppServiceProvider implements ProvidesPhpIni { /** * Executed once the native application has been booted. @@ -16,43 +13,15 @@ class NativeAppServiceProvider */ public function boot(): void { - Menu::new() - ->appMenu() - ->submenu('About', Menu::new() - ->link('https://beyondco.de', 'Beyond Code') - ->link('https://simonhamp.me', 'Simon Hamp') - ) - ->submenu('View', Menu::new() - ->toggleFullscreen() - ->separator() - ->link('https://laravel.com', 'Learn More', 'CmdOrCtrl+L') - ) - ->register(); - - Window::open() - ->width(800) - ->height(800); - - /** - Dock::menu( - Menu::new() - ->event(DockItemClicked::class, 'Settings') - ->submenu('Help', - Menu::new() - ->event(DockItemClicked::class, 'About') - ->event(DockItemClicked::class, 'Learn More…') - ) - ); - - ContextMenu::register( - Menu::new() - ->event(ContextMenuClicked::class, 'Do something') - ); + Window::open(); + } - GlobalShortcut::new() - ->key('CmdOrCtrl+Shift+I') - ->event(ShortcutPressed::class) - ->register(); - */ + /** + * Return an array of php.ini directives to be set. + */ + public function phpIni(): array + { + return [ + ]; } } diff --git a/src/Commands/LoadPHPConfigurationCommand.php b/src/Commands/LoadPHPConfigurationCommand.php new file mode 100644 index 0000000..b3b7a71 --- /dev/null +++ b/src/Commands/LoadPHPConfigurationCommand.php @@ -0,0 +1,22 @@ +phpIni(); + } + echo json_encode($phpIni); + } +} diff --git a/src/Contracts/ProvidesPhpIni.php b/src/Contracts/ProvidesPhpIni.php new file mode 100644 index 0000000..09ac01e --- /dev/null +++ b/src/Contracts/ProvidesPhpIni.php @@ -0,0 +1,8 @@ +hasConfigFile() ->hasRoute('api')