Skip to content

About

Starter app for RageKit: composer create-project ragekit/starter

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

My RageKit app

A desktop app written in PHP with RageKit: the PHP is compiled to native code by TypePHP, and the UI is drawn by Slint (no browser engine).

Requirements

PHP 8.4+, Composer, git, tar and a C++ compiler. On Debian or Ubuntu:

sudo apt install php8.4-cli composer git build-essential \
    libfontconfig1 libfreetype6 libxkbcommon0 libinput10 libgbm1 libudev1 \
    php8.4-dev libphp8.4-embed cmake libgmp-dev libmpfr-dev

The last line is optional: without it the first normal build compiles a private PHP (~10 minutes, once). composer build -- --nano needs neither.

Windows: Visual Studio 2022 Build Tools ("Desktop development with C++") and 7-Zip. When the Build Tools are missing, composer create-project offers to install them (or run powershell -ExecutionPolicy Bypass -File vendor\ragekit\ragekit\install-build-tools.ps1). macOS isn't supported yet.

Run it

composer start      # build, then start the app (vendor/bin/ragekit run)
composer dev        # hot reload: edit a template or PHP file and the window updates
composer build      # compile only, into build/slint/

The first build checks the toolchain. If ragekit setup didn't run when the app was created (or RageKit was updated since), run it, and ragekit doctor to see what's missing:

vendor/bin/ragekit setup
vendor/bin/ragekit doctor

What's where

Path What it is
main.php main(): runs the app
src/MyApp.php the app: its store, its first screen, the main window's title and size
src/Screens/ screens: state (public properties) and event handlers (public methods)
src/Components/ child components other templates use as <Name />
src/Windows/ windows with their own title bar
src/Stores/ app-wide state: AppStore and its stores ($store->profile->name in templates)
src/Flows/ flows: one user action step by step (update a store, call a service, store the result)
src/Services/ outside calls, e.g. an API client
src/Assets/ the app's images (Images::LOGO), registered in MyApp::assets(); templates show $assets->images->logo
assets/ the image files
templates/ what things look like: templates/Screens/HomeScreen.rk belongs to src/Screens/HomeScreen.php
project.yml build settings: kit (shadcn or material), renderer, modules, nano: true

Making new pieces

vendor/bin/ragekit make:screen Login       # src/Screens/LoginScreen.php + templates/Screens/LoginScreen.rk
vendor/bin/ragekit make:window App         # src/Windows/AppWindow.php + its template (your own title bar)
vendor/bin/ragekit make:component UserBadge # src/Components/UserBadge.php + its template
vendor/bin/ragekit make:store Session      # src/Stores/Session.php, added to AppStore
vendor/bin/ragekit make:service GithubApi  # src/Services/GithubApi.php
vendor/bin/ragekit make:flow LoadUser      # src/Flows/LoadUser.php
vendor/bin/ragekit make:assets Icons       # src/Assets/Icons.php: register it in MyApp::assets()
vendor/bin/ragekit stub:publish            # copy the templates make: uses into stubs/ to change them

Next steps: RageKit's guides on getting started, templates, state, make, kits and dev mode.

License

The files of this starter are free to use without conditions (MIT-0). The app you build contains RageKit's runtime, which is GPLv3, so if you distribute the app it must be GPLv3 too (with its source). It also contains PHP's runtime and Slint; see RageKit's licensing notes.

About

Starter app for RageKit: composer create-project ragekit/starter

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages