mage-eye / nativephp-win-pre
Requires
- laravel/framework: ^v11.0
- nativephp/laravel: ^v0.6.1
This package is auto-updated.
Last update: 2024-11-05 16:23:43 UTC
README
About The Project
WinPre is a library for NativePHP. It aims at helping you with orchestrating a application with multiple windows.
Getting Started
Prerequisites
Before you are able to install the package you will need to meet these requirements:
- Running a application with
laravel/framework
version 11 or higher. - Running a application with
nativephp/laravel
version 0.6.2 or higher.
Installation
- To install WinPre in the root of your project run:
composer require jcombee/nativephp-win-pre
- You can now publish the example preset file (
routes/window.php
).php artisan vendor:publish --provider="JCombee\Native\WinPre\WinPreServiceProvider"
Usage
Open your first window
While following the Installation steps you have, by default, created a preset for the main window that looks like this:
// routes/window.php Preset::preset('main', static function (Window $window) { $window->url('/') ->width(300) ->height(300); });
To actually be able to open a window with this preset follow these steps:
- Remove the
Window::open();
fromapp/Providers/NativeAppServiceProvider.php
- Now fill the
boot()
function with:\JCombee\Native\WinPre\Facades\WinPre::open('main')
- Run
php artisan native:serve
Now you will see that the first window will be opened based on the settings you have set in the preset.
Pass through parameters
Sometimes you might want to add some dynamic configuration to your window, for instance the url. To do this we can add parameters to our preset.
To do this we first add a new preset in routes/window.php
:
// routes/window.php Preset::preset('dish:{dish}', static function (Window $window, $dish) { $window->url('/dish/' . $dish); });
To open this preset we call:
\JCombee\Native\WinPre\Facades\WinPre::open('dish:{dish}', 'goulash');
By calling this it will take the parameter called dish and replace this in the id for the window.
Roadmap
- Initial project setup
- Add Additional Examples / Documentation
- Creating simple presets
- Pass through parameters
- Making the parameter available in the preset
- Replacing the parameter in the id
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Jerke Combee - @JCombee - jerke1988@gmail.com
Project Link: https://github.com/JCombee/nativephp-win-pre