PHPackages                             imarc/spa-treatment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. imarc/spa-treatment

ActiveProject[Framework](/categories/framework)

imarc/spa-treatment
===================

Imarc Laravel SPA application skeleton

1.0.3(2w ago)03↓100%MITPHPPHP ^8.3

Since Apr 20Pushed 2w agoCompare

[ Source](https://github.com/imarc/spa-treatment)[ Packagist](https://packagist.org/packages/imarc/spa-treatment)[ RSS](/packages/imarc-spa-treatment/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (16)Versions (5)Used By (0)

SPA Treatment 🪷
===============

[](#spa-treatment-)

**Imarc’s Laravel starter for single-page applications.** It wires together a session-first API (Laravel Sanctum), a Vue 3 front end (Vite), an admin panel (Filament), and roles/permissions (Spatie)—plus API docs, an HTTP client collection, tests, and team conventions—so new projects begin from a consistent baseline instead of an empty `laravel new`.

Install it as a new project:

```
composer create-project imarc/spa-treatment
```

The Composer `post-create-project-cmd` script generates an application key, ensures a SQLite file exists at `database/database.sqlite`, and runs migrations when possible. **Configure your database and environment** in `.env` (see [Configuration](#configuration)) before relying on a fresh install in production or on a team database.

---

Requirements
------------

[](#requirements)

ToolNotes**PHP**`^8.3` (see `composer.json`)**Composer**For PHP dependencies and scripts**Node.js + npm**For Vite, Vue, and front-end tooling**Database**Matches `.env` (example uses MariaDB/MySQL; tests use SQLite in-memory)---

Quick start
-----------

[](#quick-start)

After `composer create-project` (or cloning this repo):

```
composer install
cp .env.example .env   # skipped if .env already exists
php artisan key:generate # skipped if key already set by create-project
php artisan migrate
npm install
npm run dev
```

In another terminal, serve the app if you are not using a full stack (e.g. Laravel Herd, Valet, or Docker):

```
php artisan serve
```

For an all-in-one local stack (server, queue, logs, Vite), use:

```
composer dev
```

---

Running with Imarc Ops
----------------------

[](#running-with-imarc-ops)

[Imarc Ops](https://github.com/imarc/ops) is a Docker-based local development environment aimed at PHP projects: shared services (MariaDB, Redis, Mailhog, and others), HTTPS with local certs, and projects under `$HOME/Sites` served at `https://{project-directory}.imarc.io` by default. Install and usage are covered in the [Ops README](https://github.com/imarc/ops/blob/master/README.md).

### Project hints in `.env`

[](#project-hints-in-env)

`.env.example` includes **`OPS_PROJECT_BACKEND`** (for example `apache-php84`) so Ops selects the right PHP/Apache stack. Adjust **`APP_URL`**, **`SANCTUM_STATEFUL_DOMAINS`**, and **`DB_*`** to match your Ops hostname and the MariaDB database you use (hostname is typically `mariadb` from inside containers—see Ops docs for connecting apps to shared services).

### Artisan through Ops

[](#artisan-through-ops)

With Ops, **MariaDB and other services run in Docker**. Your app’s PHP process must run in the same environment where `.env` (for example `DB_HOST=mariadb`) resolves correctly.

**Use `ops artisan`, not `php artisan`, for any Artisan command that touches the database**—migrations, seeders, `db:*`, `queue:*` when using the database driver, `php artisan test` against the real dev DB, and anything else that opens a DB connection. Running `php artisan` on the host can point at the wrong network or fail to reach the containerized database.

```
ops artisan
```

Examples: `ops artisan migrate`, `ops artisan db:seed`, `ops artisan tinker`.

Commands that never touch the database may still work from the host with `php artisan`. This project’s **`phpunit.xml`** uses an in-memory SQLite database for PHPUnit, so **`php artisan test` on the host** often works without Ops; use **`ops artisan test`** if you need the runner (or DB) inside the app container.

### `ops-commands.sh` helpers

[](#ops-commandssh-helpers)

This repo ships **`ops-commands.sh`** with shell helpers you can load from the project root:

```
source ops-commands.sh
```

HelperWhat it does**`ops-install`**Ensures `.env` and `phpunit.xml` exist, creates a MariaDB database named from the Ops project (`ops project name`, with `-` → `_`), runs `composer install`, `npm install`, `npm run filament:build`, `npm run build`, symlinks `public/storage` if missing, then `ops artisan key:generate` and **`ops artisan migrate:fresh --seed`**.**`ops-artisan`**Wrapper around `ops shell php ./artisan`—useful if you prefer that execution path instead of `ops artisan`.**`ops-reset`**Runs **`ops artisan migrate:fresh --seed`** to wipe and reseed the database.Load the file once per shell session (or add `source` to your profile for this project). **`ops-install` is destructive to local data** the first time you run it in an existing database because it uses `migrate:fresh --seed`.

---

What’s included
---------------

[](#whats-included)

### Laravel Sanctum (SPA / cookie sessions)

[](#laravel-sanctum-spa--cookie-sessions)

- First-party SPA authentication uses **stateful** Sanctum: session cookies and CSRF, not bearer tokens for the default API surface described in `openapi.yml`.
- `bootstrap/app.php` enables `statefulApi()` so API routes participate in the SPA cookie session.
- Configure **`SANCTUM_STATEFUL_DOMAINS`** in `.env` so the browser origin (and tools like Bruno) match your app host—required for CSRF and session auth to work across your dev and production domains.

### Filament admin panel

[](#filament-admin-panel)

- Default panel is mounted at **`/admin`** (`App\Providers\Filament\AdminPanelProvider`).
- **`User` management** is scaffolded under `app/Filament/Resources/Users/`.
- Only users with the **`admin`** role may access the panel (`User::canAccessPanel`).
- **[stechstudio/filament-impersonate](https://github.com/stechstudio/filament-impersonate)** is included for user impersonation from the admin UI (configure per package docs as needed).

### Roles and permissions (Spatie)

[](#roles-and-permissions-spatie)

- **[spatie/laravel-permission](https://spatie.be/docs/laravel-permission)** is installed and migrated.
- Custom `App\Models\Role` defines constants such as **`admin`** and **`editor`**; seeders populate roles, permissions, and a starter user (see `database/seeders/`).
- **`Gate::before`** in `AppServiceProvider` grants admins full authorization while keeping policy-based checks elsewhere—see `AGENTS.md` for the intended pattern.

### imarc/fort

[](#imarcfort)

- **[imarc/fort](https://github.com/imarc/fort)** (“Safe API filtering &amp; sorting for Laravel”) is required so list endpoints can share consistent, safe query filtering and sorting conventions as the API grows.

### Vite and Vue 3

[](#vite-and-vue-3)

- **Vite** drives the asset pipeline; the main SPA entry is `resources/js/index.js` (Vue 3 app mounted on the Blade shell).
- **Vue Router**, **Pinia**, and **@pinia/colada** are included for routing and data layers.
- **Tailwind CSS v4** (via `@tailwindcss/vite`), **Sass**, **ESLint**, **Stylelint**, **Prettier**, and **Vitest** are present for styling and quality gates.
- Imarc libraries **`@imarc/pronto`** and **`@imarc/vitrine`** are wired in `package.json` / `vite.config.js` for internal UI and dev tooling patterns.

The catch-all **`routes/web.php`** route returns the SPA shell view so client-side routing can own navigation.

### OpenAPI (`openapi.yml`)

[](#openapi-openapiyml)

- **`openapi.yml`** at the repository root describes the **SPA Treatment API** (OpenAPI 3). It documents session-based auth expectations and paths such as `/api/auth/login` and `/api/auth/current-user`.
- Treat it as the contract for consumers: when you add or change endpoints, update this file (and tests) in the same change.

### Bruno collection (`bruno/`)

[](#bruno-collection-bruno)

- A **[Bruno](https://www.usebruno.com/)** collection lives under **`bruno/`**, with **`opencollection.yml`** defining shared behavior (for example Referer handling for Sanctum stateful domains and CSRF cookie bootstrap).
- Environment variables (for example **`host`**) should match your local or staging base URL so cookies and CSRF flow match the SPA.

### Test suite

[](#test-suite)

- **PHPUnit** is configured via `phpunit.xml` with **`tests/Unit`** and **`tests/Feature`**, using an in-memory SQLite database and isolated env defaults for fast, repeatable runs.
- Run the suite with:

    ```
    php artisan test
    ```

    or `composer test` (clears config cache first).
- **Vitest** is available through Vite for front-end unit tests (`vite.config.js` includes a `test` block); add `npm` scripts as your team standardizes JS testing.

### `AGENTS.md` (conventions for people and AI)

[](#agentsmd-conventions-for-people-and-ai)

- **`AGENTS.md`** is the canonical guide for **workflows, structure, naming, API parity with the SPA, and quality checks** (Pint, Psalm, tests, lint). Human contributors and coding agents should follow it so generated code matches project expectations.

---

Other notable dependencies
--------------------------

[](#other-notable-dependencies)

- **sentry/sentry-laravel** — error monitoring (configure DSN and environment in `.env` when you enable Sentry).
- **Laravel Tinker**, **Collision**, **Pail**, **Pint**, **Psalm** (with Laravel plugin) — debugging, style, and static analysis in development.

---

Configuration highlights
------------------------

[](#configuration-highlights)

Copy **`.env.example`** to **`.env`** and adjust at least:

VariablePurpose`APP_URL`Must match how users reach the app (affects URL generation and Sanctum).`DB_*`Database connection for migrations and the app.`SESSION_DRIVER`Example uses `database`; ensure the sessions table exists if you keep it.`SANCTUM_STATEFUL_DOMAINS`Comma-separated hosts that may receive Sanctum SPA cookies (include ports for local dev).`VITE_APP_NAME`Passed to the front end for display/branding.For **Filament** assets in production, build the dedicated Vite config when needed:

```
npm run filament:build
```

---

Useful Composer scripts
-----------------------

[](#useful-composer-scripts)

ScriptWhat it does`composer setup`Install deps, ensure `.env`, key, migrate, npm install, production `npm run build``composer dev`Concurrently runs `php artisan serve`, queue worker, `pail`, and `npm run dev``composer test`Clears config cache and runs `php artisan test``composer pint`Laravel Pint (code style)`composer psalm`Psalm static analysis---

Repository layout (orientation)
-------------------------------

[](#repository-layout-orientation)

AreaLocationHTTP API routes`routes/api.php`Web / SPA shell`routes/web.php`, `resources/views/index.blade.php`Vue app`resources/js/`Styles`resources/styles/`, `resources/css/`Filament`app/Filament/`, `app/Providers/Filament/`Models &amp; policies`app/Models/`, `app/Policies/`API contract`openapi.yml`Bruno requests`bruno/`PHPUnit tests`tests/`Imarc Ops–specific helpers live in **`ops-commands.sh`** (see [Running with Imarc Ops](#running-with-imarc-ops)).

---

Quality checklist (before you merge)
------------------------------------

[](#quality-checklist-before-you-merge)

From `AGENTS.md`, the usual bar is:

- `composer pint`
- `composer psalm`
- `php artisan test`
- Front-end lint/build as your `package.json` scripts define (align scripts with `AGENTS.md` over time)

---

License
-------

[](#license)

This starter is released under the **MIT** license (see `composer.json`).

Laravel itself is open-source software under the [MIT license](https://opensource.org/licenses/MIT); see [laravel.com](https://laravel.com/docs) for framework documentation.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance96

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

4

Last Release

19d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/42547992?v=4)[Dave Anastasi](/maintainers/daveanastasi)[@daveanastasi](https://github.com/daveanastasi)

---

Top Contributors

[![daveanastasi](https://avatars.githubusercontent.com/u/42547992?v=4)](https://github.com/daveanastasi "daveanastasi (19 commits)")

---

Tags

frameworklaravel

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/imarc-spa-treatment/health.svg)

```
[![Health](https://phpackages.com/badges/imarc-spa-treatment/health.svg)](https://phpackages.com/packages/imarc-spa-treatment)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.1k2.2k](/packages/unopim-unopim)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[codewithdennis/larament

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3861.7k](/packages/codewithdennis-larament)[openclassify/openclassify

The skeleton application for the Laravel framework.

3152.5k](/packages/openclassify-openclassify)[ercogx/laravel-filament-starter-kit

This is a Filament v5 Starter Kit for Laravel 13, designed to accelerate the development of Filament-powered applications.

441.7k](/packages/ercogx-laravel-filament-starter-kit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
