fapost/foundation and fapost/support — and any Solution or Plugin you build —
live in their own git repositories, and so does the console kit @fapost/ui. This page explains how a package is developed
against a Core checkout, and the two ways it reaches an install: as a dependency
Core itself declares, or as an overlay Core never names.
The Core-owned shared packages use the fapost/* vendor and live under the
fapost-lab organization. A Solution or Plugin you
contribute is your own package: it uses your vendor (for example
acme/hr-solution) and any git host you like. Everything below works the same
regardless of vendor — nothing is hard-coded to fapost.
How it works
Each package is a standalone repository. During development its source is checked out intopackages/<dir>, which the Core repository ignores (/packages is in
.gitignore). The checkout directory name is free; the package’s Composer name
is what matters.
Two lanes coexist without ever editing composer.json per environment:
composer.json and composer.lock always describe the production lane, so they
are safe to commit. The local symlinks are created outside Composer’s dependency
resolution, so they never leak into the lock file.
The linker
tools/dev-link-packages.php, exposed as the dev:link Composer script, replaces
the Composer-installed copy of each package under vendor/ with a relative
symlink to its local source. It is wired into post-install-cmd and
post-update-cmd, so it runs automatically after every composer install and
composer update.
It auto-discovers packages by reading each packages/*/composer.json and linking
vendor/<name> from that file’s name — so any vendor works with no changes to
the linker. It is a no-op when packages/ is absent, which is why the same hook
is safe in production and CI.
A checkout is linked only when Core asks for it and accepts it:
- the package is in
requireorrequire-devof the root manifest —composer.json, or the fileCOMPOSERnames, which iscomposer.local.jsonwhile an overlay is installed; - its constraint is
@devordev-*, or apathrepository points at the checkout, or the checkout’s latest tag (git describe --tags) satisfies the constraint.
vendor/ keeps the copy
Composer installed from composer.lock. A checkout of fapost/foundation at
v0.33.0 is not linked into a Core that requires ^0.30: it would break every
contract Core implements. When such a package is still linked from an earlier run,
the linker removes the link and asks for composer install, which puts the locked
copy back. A package only an overlay requires keeps
its link when dev:link runs without COMPOSER, as long as Composer lists it as
installed.
Set up an existing package for development
Clone the package intopackages/ next to the others, then let Composer link it:
vendor/fapost/foundation as a symlink to
packages/fapost-foundation. A plain composer install re-creates the symlink on
its own.
From here, edits inside packages/fapost-foundation are picked up instantly — no
composer update needed. The checkout is a normal git repository: branch, commit,
and push it independently of Core.
The console kit, an npm package
@fapost/ui, the console kit, is an npm package
(fapost-lab/ui) that Core installs from the
registry like any other dependency; package.json and package-lock.json always
describe that lane. It is developed the same way as the Composer packages: clone it
into packages/ and link it over node_modules/.
node_modules/@fapost/ui with a relative symlink to
packages/fapost-ui. tools/dev-link-npm.mjs links every packages/*/package.json
whose name Core depends on, runs as postinstall so a plain npm install or
npm ci restores the link, and is a no-op without packages/. make dev-link runs
both linkers; the npm one runs on the host, where node_modules is installed, so it
needs Node there.
The kit ships its sources, so Vite serves an edit in packages/fapost-ui at once,
with no build and no release. The checkout has its own node_modules; Core’s
resolve.dedupe in vite.config.ts and vitest.config.ts, and the paths for the
kit’s peers in tsconfig.json, keep one Vue, one Inertia, one reka-ui and one
vue-sonner on the page and in type-checking either way.
Which lane a package takes
Core’s
composer.json lists only what Core needs to run. An extension that would be
written into it would ship to every install and every fork; an overlay keeps it where
it is wanted.
Add a package Core requires
This lane is for packages Core itself depends on. Assume a new package<vendor>/<name>; the steps are vendor- and host-agnostic.
1
Create the package repository
Scaffold If the package builds on the platform contracts, require them by constraint in
its own
packages/<dir> — any directory name — with its own composer.json
("name": "<vendor>/<name>", PSR-4 autoload, a license), initialise a git
repository, push it, and tag the first release:composer.json, for example "fapost/foundation": "^0.1".2
Declare it in the root composer.json
Add a VCS repository and a version constraint. This is what production resolves
against:Private repositories on a non-GitHub host may need Composer authentication
configured through
composer config or auth.json.3
Resolve and link
composer.lock from the VCS, and
post-update-cmd runs dev:link for you, replacing
vendor/<vendor>/<name> with a symlink to the local checkout. The linker
needs no changes — it discovers the new package automatically from its
composer.json name, whatever the vendor.Packages Core does not require
A Solution, a Plugin or a private extension is added on top of Core with a composer overlay: Core’scomposer.json and composer.lock stay untouched,
the package is installed against Core’s locked versions, and the same mechanism
serves local development, your extension’s CI and an image built from Core.
Quick start: develop a package against a Core checkout
1
Check the package out under packages/
packages/ is ignored by Core’s .gitignore, so the checkout never shows up in Core’s
repository:2
Describe it in composer.overlay.json
At Core’s root (the file is git-ignored too):
3
Install it
composer.local.json and composer.local.lock and installs the package against
Core’s locked versions. dev:link then links vendor/acme/my-extension to your checkout, so
edits are live.4
Keep using the overlaid manifest
Run every further Composer command in Core with A plain
COMPOSER=composer.local.json:composer install returns Core to its state without the package — composer overlay
brings it back.5
Run the package's tests inside Core
Test against the real application with Core’s PHPUnit and the package’s own configuration,
whose bootstrap loads Core’s
vendor/autoload.php:The overlay file
Describe the package incomposer.overlay.json at Core’s root. The file is
git-ignored, and only repositories and require are accepted:
path repository at your checkout under
packages/; in CI or an image use your package’s VCS repository and a version
constraint instead.
Install it
composer.local.json (Core’s manifest plus the overlay) and
composer.local.lock (a copy of Core’s lock), both git-ignored, then installs the
overlay packages against them. A package Core already requires or locks, directly
or transitively, is rejected: an overlay adds packages, it never overrides or
moves Core’s versions. If your package needs a newer version of something Core
locks, the install fails instead of upgrading Core underneath it.
post-update-cmd runs dev:link, so a checkout under packages/ is symlinked into
vendor/ exactly as in the Core-required lane.
Post-install steps
Some packages need an artisan command after they are installed — publishing their assets, for example. Core does not know your package, so the package declares the commands itself, in its owncomposer.json:
composer overlay reads this list from each overlay
package’s installed manifest (vendor/<name>/composer.json, which follows the
dev:link symlink to your checkout) and runs php artisan <command> for every
entry, printing [overlay] <package>: php artisan <command> before each. Only
overlay packages are read; Core’s own dependencies never run anything.
Each entry is a bare artisan command name — lowercase letters, digits, : and -,
with no arguments and no shell. A list that is not a list of such names fails the
run with the package’s name before any command runs, and a command that fails stops
the run with its exit code.
When Composer’s scripts are disabled the steps are skipped as well, since packages
are not discovered yet; run them once discovery has happened. An image build or CI
does this by calling the script directly:
composer dev:link, after changing the
package or after a --no-scripts install — without reinstalling anything:
public/css/filament/, public/js/filament/ and
public/fonts/filament/ are git-ignored in Core, since only overlay packages put them
there.
Options reach the script after --, because Composer strips the first -- and
drops options it does not know before it:
Working with an overlay
Run further Composer commands withCOMPOSER=composer.local.json, so they read the
overlaid manifest:
composer install or composer update goes back to Core alone and
uninstalls the overlay package from Composer’s point of view — a quick way to
check that Core still runs without your extension. Run composer overlay again to
bring it back.
In your extension’s CI
Check out Core, place your package underpackages/, write an overlay with a
path repository to it, and run:
<package>: <field>: <message> line per problem and exits with
code 1 when the manifest is wrong. See The Solution manifest.
In an image built from Core
An image that adds an extension on top of the Core image runs the script directly: passing--no-scripts to composer overlay would disable the overlay script
itself, because Composer scans all raw arguments. The Core image removes Composer
and runs as www-data, so switch to root for the build step, copy Composer back,
and hand the results back to www-data:
post-autoload-dump runs package discovery, so a Plugin’s service provider is found. A
Solution’s provider is not: Core boots it from the manifest, and only when the manifest is valid.
vendor/ already belongs to www-data in the Core image, so the example re-owns only the files the
build step created; re-owning vendor/ would copy all of it into a new layer. A private package
repository needs Composer credentials at build time; pass them as a build secret, never as a file
copied into the image. The mount is required=true so the build fails instead of resolving without
credentials, and Composer’s cache lives in a temporary directory removed in the same RUN, so
neither the credentials nor the cache reach a layer. Build with
docker build --secret id=composer_auth,src=auth.json ., where auth.json holds the
COMPOSER_AUTH JSON.
Publish a new version
Package changes reach production through tags, not the local checkout:composer.overlay.json and run composer overlay again instead.
With 0.x versions, ^0.1 accepts 0.1.* only; bump the constraint to ^0.2 to
adopt a new minor. Until you re-run composer update, Core keeps the version
pinned in composer.lock — your local symlinked edits are visible to you but do
not change what production installs.
Composer needs git or SSH access to each package repository to resolve it — the
fapost-lab organization for the Core packages, and your own host for your
Solution or Plugin. Make sure your key is authorised, or auth.json is set for
private hosts, before running composer update.Landlord tables of a package
An extension may keep platform-level data of its own, for example plans or usage per tenant, in thelandlord database. The rules:
- Name every table with the package’s own prefix, such as
saas_. - Never write Core’s landlord tables (
tenants,webhook_registry) and never put a foreign key on them. Refer to a tenant by its id and clean up your own rows yourself. - Deliver the migrations with
loadMigrationsFrom()in the package’s service provider. - Declare
protected $connection = 'landlord';in each migration, and keep it pure DDL.