# How it works

There's no magic in partisan and very little code — it's a thin, careful layer over two excellent Orchestra tools that most Laravel packages already depend on.

## The architecture

1. **[Orchestra Testbench](https://packages.tools/testbench)** boots a full skeleton Laravel application around your package. It's how virtually every Laravel package runs its test suite, and its CLI provides `serve`, `migrate`, and the Workbench demo app.

2. **[Orchestra Canvas](https://github.com/orchestral/canvas)** is the generator engine: the same `make:` commands you know from artisan, routed through a pluggable *generator preset* that decides where files go and which namespace they get.

3. **Partisan** registers a preset built from your package's `composer.json` — mapping the generator targets onto your package instead of the skeleton app:

   - `autoload.psr-4` → source path and root namespace
   - `autoload-dev.psr-4` → tests path and namespace
   - `database/`, `resources/` → database and view targets
   - `extra.laravel.providers` → auto-registered providers

The result: when a generator asks "where does a model go?", the answer is `src/Models` in your namespace — and every generator in the suite inherits that answer consistently.

## `app_path()` remapping

Partisan remaps the skeleton's `app_path()` to your package's `src/`. That's what makes third-party generators cooperate without knowing about partisan — Filament's resource generator writes to `app_path('Filament/Resources')`, which now points inside your package. See [Filament plugins](https://packstub.dev/docs/partisan/filament-plugins).

## Credit where due

Testbench and Canvas do the heavy lifting here, and they're maintained by the Orchestra team with remarkable care. Partisan adds the missing piece — a preset that understands *your package is the app* — plus the finishing touches: command registration, factory wiring, and test base-class detection ([Generators](https://packstub.dev/docs/partisan/generators)).

## Tested against real generators

Partisan's own suite generates every supported file type into a disposable fixture package and asserts the resulting paths and namespaces, for both Laravel and Filament generators. If a Laravel or Filament release changes a stub, the suite catches it.
