Search by

fapost / solution-hello-world

bpartner

The smallest working FaPost Solution: one action for the call node and one console page

Package info

github.com/fapost-lab/solution-hello-world

Type:fapost-solution

pkg:composer/fapost/solution-hello-world

Statistics

Installs: 26

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-11-30 16:20 UTC

This package is auto-updated.

Last update: 2026-11-30 18:11:09 UTC


README

The smallest working FaPost Solution. It is a demo for contributors and a test subject for Core's Solution mechanism on a genuinely Composer-installed package.

Docs: Solutions and Console UI.

What it shows

Piece Where
The manifest: type: fapost-solution and extra.fapost (id hello, provider, actions, UI bundle) composer.json
An action for the flow call node: hello.greet takes a name and returns {"greeting": "Hello, <name>!"} (world when the name is missing or blank) src/Actions/GreetAction.php
A provider that registers the action, an ability, one console application with one menu entry, and one route src/HelloWorldServiceProvider.php
One console page, hello::Home, written as a Vue single-file component resources/js/pages/Home.vue, src/HelloWorldController.php
The prebuilt bundle Core publishes and the browser loads, with the declaration fapost-ui.json dist/

Nothing here imports App\…: src/ depends on fapost/foundation only, and the integration tests in tests/ use Core's Solution testing kit (Fapost\Testing\SolutionTestCase) and Foundation.

Install into a Core checkout

The package is added on top of Core with a composer overlay, so Core's own composer.json stays untouched. From the root of a Core checkout:

git clone https://github.com/fapost-lab/solution-hello-world.git packages/solution-hello-world

Add these entries to your composer.overlay.json (create the file if there is none; keep what is already in it):

{
  "repositories": [{ "type": "path", "url": "packages/solution-hello-world" }],
  "require": { "fapost/solution-hello-world": "@dev" }
}
composer overlay

Further Composer commands in that checkout need COMPOSER=composer.local.json.

Then let Core validate the manifest and publish the bundle, and switch the Solution on for a tenant:

php artisan platform:update
php artisan solutions:list --tenant=<slug>
php artisan solutions:activate hello --tenant=<slug>

platform:update --validate-only only checks the manifests. Once activated, the tenant's console shows a "Hello World" application whose page greets the world. php artisan solutions:deactivate hello --tenant=<slug> switches it off again.

Use the action in a flow

In a flow, add a call node with the handler transport and hello.greet as its target:

{
  "id": "greet",
  "type": "call",
  "version": 1,
  "config": {
    "transport": "handler",
    "target": "hello.greet",
    "parameters": { "name": "Ada" },
    "result_mapping": [
      { "from": "payload.greeting", "to": { "name": "greeting", "storage": "session" } }
    ]
  }
}

The call's payload is {"greeting": "Hello, Ada!"}; the mapping above stores it in the session variable greeting. While the Solution is not active for the tenant, the node fails with solution_inactive: hello.

The page title comes from the server (hello::console.app). Only en translations are shipped; other locales fall back to them.

Develop the UI

Core has no Node, so the built dist/ is committed. After changing resources/js/:

npm ci
npm run build

npm run build runs Vite with FaPost's preset @fapost/vite-plugin-solution (vite.config.js): it keeps vue, @inertiajs/vue3 and @fapost/ui external because the console supplies them, and writes dist/fapost-ui.json with the Solution id from composer.json. All three are pinned in package.json at the versions Core ships, so imports resolve against the real kit; the kit, vue and inertia ranges in fapost-ui.json come from those installed versions, and Core refuses to activate the Solution when its own versions fall outside them. Commit the result; CI rebuilds it and fails if it differs from the committed files.

Run the tests

The tests boot Core's real application with this package installed, through Core's testing kit, so run them inside a Core checkout that has the package installed as above (a Core release that ships the kit):

php artisan config:clear
cd packages/solution-hello-world
php ../../vendor/bin/phpunit -c phpunit.xml

Code style: ../../vendor/bin/pint --config pint.json src tests lang.

Contributing

Contributions are licensed under Apache-2.0 and need the Contributor Licence Agreement, which a bot asks you to sign on your first pull request. CI checks out the public fapost-lab/core and runs the tests inside it, in pull requests from forks too; nothing needs to be configured.

License

Apache-2.0, see LICENSE.