nvl / core
Native Laravel support contracts, configuration, model identity, and ownership ports
Requires
- php: ^8.4
- composer-runtime-api: ^2.2
- ext-ctype: *
- ext-filter: *
- ext-mbstring: *
- ext-pdo: *
- laravel/framework: ^13.30
- symfony/http-foundation: ^7.4.23 || ^8.1.11
Requires (Dev)
- larastan/larastan: ^3.10
- laravel/pint: ^1.27
- mockery/mockery: ^1.6
- nvl/activity: ^7.0
- nvl/auth: ^7.0
- nvl/billing: ^7.0
- nvl/comments: ^7.0
- nvl/content: ^7.0
- nvl/csv: ^7.0
- nvl/filterable: ^7.0
- nvl/forms: ^7.0
- nvl/mail-notifications: ^7.0
- nvl/media: ^7.0
- nvl/metafields: ^7.0
- nvl/ownership: ^7.0
- nvl/pages: ^7.0
- nvl/payments: ^7.0
- nvl/primitives: ^7.0
- nvl/seo: ^7.0
- nvl/settings: ^7.0
- nvl/tasks: ^7.0
- nvl/taxonomy: ^7.0
- nvl/templates: ^7.0
- nvl/translatable: ^7.0
- nvl/translations: ^7.0
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/phpstan: ^2.2.5
- phpunit/php-code-coverage: ^12.0
- phpunit/phpunit: ^12.0
- psr/log: ^3.0
- symfony/console: ^7.4 || ^8.0
- symfony/filesystem: ^7.4.23 || ^8.1.11
- symfony/process: ^7.0 || ^8.0
Suggests
None
Provides
None
Conflicts
- guzzlehttp/guzzle: <7.15.2 || >=8.0.0 <8.0.1
- guzzlehttp/psr7: <2.12.3
- league/commonmark: <2.10.2
- league/flysystem: <3.35.3
- nvl/forms: <7.4.0
- nvl/support: *
- paragonie/random_compat: <2.0
- symfony/http-kernel: <7.4.23 || >=8.0.0 <8.1.11
- symfony/mailer: <7.4.12 || >=8.0.0 <8.0.12
- symfony/mime: <7.4.22 || >=8.0.0 <8.1.10
- symfony/polyfill-intl-idn: <1.38.1
- symfony/routing: <7.4.23 || >=8.0.0 <8.1.11
- symfony/translation: <6.4.8 || >=7.0.0 <7.0.8
Replaces
None
README
Native Laravel support contracts, configuration, model identity, locale services and optional Ownership ports. Requires PHP 8.4 and Laravel 13 (minimum 13.30).
Core auto-discovers SupportServiceProvider and the deferred LocaleServiceProvider. It supplies safe unowned defaults without activating domain packages, routes, Data, TypeScript, consumer-policy analysis or the retired Tenancy bridge. Consumers own inputs, Actions, transport adapters, resources and frontend types.
Register application owner models in nvl-core.owners. Identity registration does not authorize access. Supply explicit principals, SystemActor::Background or PublicActor::Anonymous to the owning package's native service; background and public execution remain distinct and subject to host policy.
SystemActor implements Laravel's Authorizable ability contract for compatible global Gate hooks, including optional permission integrations. Its can method evaluates the Gate for that explicit enum; it supplies no login identity or default grant and does not implement Authenticatable. Host hooks used by native background operations must accept the actual actor type rather than assume an application User model.
Native Ownership declarations, model guards, queue envelopes and committed-event dispatch remain available. Owned or previously adopted storage fails closed when its enforcing runtime is absent. Install nvl/ownership for enabled isolation and recovery. Core registers nvl:queue:retry <failed-job-id> itself: it requeues a captured or quarantined failed job verbatim, without restoring its command, whether or not nvl/ownership is installed; native queue:retry is refused for such records.
Core preserves host bindings and Laravel bus/batch behavior. DomainEventDispatcher publishes on the actual source connection's outer commit; rollback discards publication. Local callbacks are not a durable outbox. See event delivery.
Configuration defaults require no publication. The supported tags are nvl-core-config, nvl-core-migrations, nvl-core-translations and nvl-core-skills. Domain diagnostics and migrations remain with their owning packages; Core's only migration is the opt-in adoption run store.
Canonical configuration uses nvl-core and each capability's nvl-<package> root. Legacy roots, environment fallbacks, option aliases and global-name compatibility switches are unavailable. Host registrations remain authoritative.
Bind Nvl\Support\Contracts\TextMatcher to share application-specific text folding across packages that use it. The default matches literal substrings, with opt-in SQL wildcards, Unicode case folding on SQLite, and ILIKE on PostgreSQL. PostgreSQL uses pg_catalog.pg_c_utf8 on 17 and newer and pg_catalog.und-x-icu on 16. Set nvl-core.search.postgres_collation to a deterministic collation name, optionally qualified by schema, to override it. nvl:doctor checks the selected Core PostgreSQL connection.
For optional console setup and combined diagnostics, explicitly register Nvl\Support\Providers\DoctorServiceProvider in bootstrap/providers.php. It supplies nvl:install (including --dry-run) and nvl:doctor; Core's auto-discovered providers remain passive. See the installation guide and service and model extension contracts.
Adoption
nvl:adopt {package} {phase=plan} {manifest?} (phases plan, apply, verify, activate and abandon) runs a package's registered adoption adapter as SystemActor::Background, through that package's normal authorization. The optional manifest is a JSON options file. Phases run in order:
planreads the source graph and destination, reports the fingerprint, expected counts and collisions, and writes nothing.apply --fingerprint=<reviewed>refuses collisions, a changed fingerprint or an open transaction, then commits keyset batches (--batch-size, defaultnvl-core.adoption.batch_size). Each batch's rows and checkpoint commit together. Resume a stopped run with--run=<id>, the original fingerprint and the same manifest.verifyscans committed source and destination independently and records the verification digest.activate --fingerprint=<reviewed>locks the run, re-authorizes, verifies again and marks it active. It changes no configuration.
A scope keeps its first run. If the source, the options, the adapter version or a staged row changes, or a staged row behind a checkpoint is deleted, apply refuses to resume and planning again does not help. Revert the change and resume with the original fingerprint, or run abandon --run=<id> and then plan and apply again. Abandon authorizes like apply, locks the run, refuses an active run and deletes the run and its checkpoints. It leaves staged destination rows in place: the next plan treats identical staged rows as already staged and reports differing ones as collisions, which you resolve before applying.
Custom adapters own two drift checks. plan() reports staged rows that differ from their source as collisions. assertCheckpoint($step, $cursor, $processed) runs under the run lock for each step's stored checkpoint, completed ones included, the first time a resumed apply reads it: re-read the source rows at or before the cursor (AdoptionStep::through()), map them as writeBatch() does and throw unless every mapped row, child rows included, is still staged. Its default fails closed. An adapter that locks around batches in aroundBatch() takes the same lock in aroundVerification(), which wraps verify's and activate's run-locked transaction, so every phase locks in the same order.
Keep source and destination writers stopped from the final apply until activation. Runs and checkpoints store hashes, cursors and counts only, in nvl_core_adoption_runs and nvl_core_adoption_checkpoints on each adapter's destination connection. Enable nvl-core.adoption.migrations.enabled or publish nvl-core-migrations, then migrate those connections. --format=json reports the run, fingerprint, state, cursors and counts for every phase, the collisions for plan and apply, and the verification for verify.