> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fapost.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Starting a Solution

> Generate a Solution package from the templates in Core and develop it against a running Core.

`php artisan make:solution` writes a new [Solution](https://docs.fapost.in/extending/solutions.md) package: the same pieces as
[Hello World](https://github.com/fapost-lab/solution-hello-world), under your own vendor and namespace, ready to
install into a Core checkout. Run it from the root of the checkout.

```bash theme={"theme":"one-dark-pro"}
php artisan make:solution tickets acme/solution-tickets
```

| Argument or option | Meaning |
| - | - |
| `id` | The Solution id, `extra.fapost.id` in the manifest. Foundation's rules apply. |
| `package` | The Composer package name, `vendor/name`. |
| `--namespace=` | The PHP namespace of the package. Default: the studly vendor and name without a leading `solution-`, so `acme/solution-tickets` gives `Acme\Tickets`. |
| `--name=` | The display name. Default: the headline of the id. |
| `--path=` | The directory to write, relative to Core's root or absolute. Default: `packages/<name part of the package>`. |

Everything is checked before anything is written. The command exits with 1 and writes nothing when the package name
is not a valid Composer name, when a namespace segment is not a PHP identifier (pass `--namespace`, for example for
`acme/solution-2fa`), when Foundation rejects the manifest, or when the target directory exists and is not empty.

## What it generates

| Piece | Where |
| - | - |
| The manifest | `composer.json` |
| An action for the flow `call` node, `<id>.greet` | `src/Actions/GreetAction.php` |
| A provider that registers the action, an ability, one console application and one route | `src/<Class>ServiceProvider.php`, `src/<Class>Controller.php` |
| One console page written as a Vue component, and its prebuilt bundle | `resources/js/pages/Home.vue`, `dist/` |
| Unit and integration tests that run inside Core with its [testing kit](https://docs.fapost.in/extending/testing.md) | `tests/` |
| CI that runs them against Core `main` and the latest release, and rebuilds the UI bundle | `.github/workflows/ci.yml` |
| Pint, PHPUnit and Vite configuration, `package.json` and its lock file | repository root |
| A README with the steps below | `README.md` |

`<Class>` is the last segment of the namespace.

## Next steps

**1. Install it into Core**

Add the package to `composer.overlay.json`, then run `composer overlay`. See
[Development setup](https://docs.fapost.in/extending/development-setup.md#packages-core-does-not-require).

**2. Let Core validate it and switch it on**

```bash theme={"theme":"one-dark-pro"}
php artisan platform:update
php artisan solutions:activate tickets --tenant=<slug>
```

**3. Develop the UI against the running Core**

In the package run `npm ci`, then `npx vite build --watch`. In Core run `php artisan solutions:watch`: it
publishes each build to the running Core, see
[Developing against a running Core](https://docs.fapost.in/extending/console-ui.md#developing-against-a-running-core). Before you
commit, run `npm run build` and commit `dist/`.

**4. Run the tests**

For the default `packages/<name>`, from the package directory: `php ../../vendor/bin/phpunit -c phpunit.xml`. The
generated README carries the overlay entry and the commands for the path the package was generated in. A package
outside the Core checkout finds Core through the `FAPOST_CORE_PATH` environment variable: set it to Core's root.

## What it does not show yet

The templates reproduce Hello World and nothing more. Whatever Hello World does not prove, the generated package does
not either: for example tenant migrations, jobs, node types, chat commands and connectors are not in it. Add them from
[Building a Solution](https://docs.fapost.in/extending/solutions.md).

The templates are kept in Core and follow its version. A generated package does not update itself: a newer Core
generates newer files, and the ones you already have stay as they are.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.