Skip to content

Modernise lacommerce for a first release under simtabi - #3

Merged
imanimanyara merged 6 commits into
masterfrom
chore/modernise-for-first-release
Oct 5, 2026
Merged

imanimanyara merged 6 commits into
masterfrom
chore/modernise-for-first-release

Conversation

@imanimanyara

Copy link
Copy Markdown
Member

Prepares simtabi/lacommerce for its first tagged release under the simtabi org. No tag is cut here.

What changed

  • Platform. PHP ^8.4.1 || ^8.5; illuminate/contracts, database, http and support at ^12.0 || ^13.0 (src/ imported them with nothing required); Testbench ^10.6 || ^11.0, PHPUnit ^11.5 || ^12.0. No lock file is tracked.
  • Tests. 22 Testbench tests over the three traits and the provider. tests.yml runs them on PHP 8.4 and 8.5, lowest and stable, on pull_request and workflow_dispatch, with no path filter so it can be made a required check.
  • Vendor-scoped config. Key simtabi.lacommerce, file config/simtabi/lacommerce.php, tag simtabi::lacommerce-config; a view/translation namespace of simtabi/lacommerce when those directories exist.
  • Metadata and docs. homepage, support.*, the badge and the doc links point at simtabi. The CHANGELOG is now Keep a Changelog with an Unreleased section. The old 0.1.0 - 2022-02-03 entry was replaced because no such tag was ever cut.

Deprecated, not removed

Old New Still works
config key lacommerce / config/lacommerce.php simtabi.lacommerce / config/simtabi/lacommerce.php yes. A published bare file is still read (the scoped file wins), and config('lacommerce.*') still returns the merged config
tag lacommerce:config simtabi::lacommerce-config yes. It still publishes config/lacommerce.php

Earliest removal: 0.2.0. Tests pin both aliases.

Behaviour changes worth reading

  • The provider no longer loads database/migrations. That directory held only a test fixture creating a dummy_models table. It was loaded into every host app, so migrate either created that table or failed on the file's non-standard name. The fixture moved verbatim to tests/Fixtures/ in its own commit. No consumer relied on a migration it shipped, but this is the one change a host app can observe.
  • The traits work again. They called static::observe() inside the trait's boot method, and current Laravel throws a LogicException there, so every model using a trait failed on first use. They now register the observer's creating/updating handlers directly. The observers are unchanged.
  • Publish-key collision avoided. Laravel keys publishable paths by source path, so registering the same source under both tags would have sent simtabi::lacommerce-config to config/lacommerce.php. The two entries use distinct spellings of the same path, and a test asserts each tag's target.
  • Loaders and tags for views, translations and assets are registered only when those directories exist. None ship today, so lacommerce:assets, :views and :translations no longer appear (they published nothing before). The install docs no longer tell users to run them.
  • Config was merged twice. It is now merged once.

Not changed

  • The bare Str::sku, Str::orderNumber and Str::ticketNumber macro names are left as they are. Renaming them is a separate decision.
  • src/.DS_Store was never tracked. It was already ignored, so there was nothing to untrack.

Verification

Run locally on PHP 8.5.3: stable deps (Laravel 13, Testbench 11.3, PHPUnit 12.5) gave 22 tests, OK. Lowest deps (Laravel 12.69, Testbench 10.6, PHPUnit 11.5) gave 22 tests, OK, with 2 deprecation notices. I checked that three of the guards can fail by reintroducing the defect: dropping the legacy merge, reloading migrations, and reverting the trait boot each turn the suite red.

The migration only creates a dummy_models table for the test suite. It sat
in database/migrations, which the provider loads into every host
application. This commit moves the file verbatim; the provider change
follows separately.
- Config is merged once (it was merged twice) under simtabi.lacommerce,
  published to config/simtabi/lacommerce.php with the tag
  simtabi::lacommerce-config.
- The bare key lacommerce and tag lacommerce:config are deprecated, not
  removed: a published config/lacommerce.php is still honoured, the bare
  key is still populated with the merged result, and the bare tag still
  publishes to config/lacommerce.php. Earliest removal: 0.2.0.
- The two publish entries use different spellings of the same source
  path, because Laravel keys publishable paths by source and a shared key
  would send both tags to the same target.
- The provider no longer loads database/migrations, which only ever held
  the test fixture now under tests/.
- Views, translations, assets: none ship, so their loaders and publish
  tags are registered only when the directory exists.
static::observe() instantiates the model, and current Laravel throws a
LogicException when a model is instantiated while it is still booting.
Every model using HasSku, HasOrderNumber or HasTicketNumber failed on its
first use. The traits now register the observer's creating and updating
handlers directly; the observers themselves are unchanged.
- PHP ^8.4.1 || ^8.5, matching the family floor.
- Require the illuminate components src/ imports, at ^12.0 || ^13.0.
- Testbench ^10.6 || ^11.0 and PHPUnit ^11.5 || ^12.0, with
  prefer-stable.
- phpunit.xml rewritten for the current schema.
- Ignore vendor/, composer.lock and PHPUnit caches; a library does not
  track its lock file.
- 22 tests cover the three traits (generation on create, refresh on
  update, manual values kept, generation disabled) and the provider
  (scoped and deprecated config keys and tags, precedence, no migrations
  loaded into the host, bindings, Str macros).
- The fixture migration gains order_number and ticket_number columns.
tests.yml runs PHPUnit on PHP 8.4 and 8.5 against lowest and stable
dependencies, on pull_request and workflow_dispatch only, with no path
filter so it can be a required check. The existing checks workflow now
validates composer.json strictly and lints tests/ instead of the removed
database/ directory.
- README: Tests badge on simtabi/lacommerce; the Packagist badge is
  dropped until the package is published, with a line saying why; the
  required Quick start guide and usage section; disclosure address
  corrected to security@simtabi.com.
- Docs: the scoped config path and tag, the deprecated bare key, the
  real config key names (source_column, destination_column), the real
  interface a custom generator implements, and no publish commands for
  assets or views the package does not ship.
- CHANGELOG: Keep a Changelog with an Unreleased section. The 0.1.0
  entry dated 2022-02-03 is replaced because no such tag exists.
Copilot AI balanced review requested due to automatic review settings October 4, 2026 23:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@imanimanyara
imanimanyara merged commit b3f0166 into master Oct 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants