# Installation

Partisan is a dev dependency of your *package* — the library you're building, not an application. It installs from Packagist like any other Composer package; no accounts or tokens are involved.

## Requirements

| Requirement | Version |
|---|---|
| PHP | `^8.2` |
| orchestra/testbench | `^10.0` or `^11.0` (Laravel 12 / 13 skeletons) |
| orchestra/canvas | `^10.0` or `^11.0` |

Testbench and Canvas are direct dependencies of partisan, so requiring partisan brings both in at compatible versions. If your package already requires Testbench (most do), Composer simply resolves the shared constraint.

## Install

From your package directory:

```bash
composer require --dev packstub/partisan
```

That's it. Verify the mapping partisan derived from your `composer.json`:

```bash
vendor/bin/partisan partisan:about
```

You should see your source path (`src/`), root namespace, tests path, and any providers discovered from `extra.laravel.providers`.

## First generator

```bash
vendor/bin/partisan make:model Invoice
```

For a package named `acme/widget` with `"Acme\\Widget\\": "src/"` in its PSR-4 autoload, this writes `src/Models/Invoice.php` with `namespace Acme\Widget\Models;`.

From here, the [Generators](https://packstub.dev/docs/partisan/generators) guide covers the full suite, and [Configuration](https://packstub.dev/docs/partisan/configuration) covers the (rarely needed) knobs.

## A shorter command

`vendor/bin/partisan` is a lot of typing for a tool you reach for constantly. Add a shell alias:

```bash
# ~/.zshrc or ~/.bashrc
alias pa="vendor/bin/partisan"
```

Then, from your package root:

```bash
pa make:model Invoice
```

If you often work from subdirectories, use a function that finds the nearest `vendor/bin/partisan` upward instead:

```bash
pa() {
  local dir=$PWD
  while [ "$dir" != "/" ]; do
    [ -x "$dir/vendor/bin/partisan" ] && { "$dir/vendor/bin/partisan" "$@"; return; }
    dir=$(dirname "$dir")
  done
  echo "no vendor/bin/partisan here — composer require --dev packstub/partisan" >&2
  return 1
}
```

## Upgrading

Partisan follows semantic versioning. Update like any Composer dev dependency:

```bash
composer update packstub/partisan
```
