Joel Male
45ef72894b
fix: correct custom driver registration hint in cart:make:driver
...
The command told users to register their driver in config/cart.php
under "drivers", but CartManager has no such registration point for
custom drivers. The actual mechanism is Cart::extend() called from a
service provider's boot() method.
2026-08-04 12:06:58 +10:00
Joel Male
c6ec19121c
docs: link README to hosted docs and correct supported Laravel versions
...
Adds a Spatie-style inline link to the extensive documentation and
points the Documentation section at the versioned v3 introduction
page. Also corrects the supported Laravel range (11-13, not 10-13)
to match the illuminate/* constraints in composer.json.
2026-08-04 12:06:57 +10:00
Joel Male
c8baf7f0a8
docs: point to the new hosted documentation site
2026-08-02 15:42:55 +10:00
Joel Male
bfdea648ae
chore: merge master, resolve conflicts keeping v3
2026-06-13 14:33:14 +10:00
Joel Male
01189993f2
feat: add applies_to support for quantity-limited item conditions
2026-06-13 14:27:42 +10:00
Joel Male
7427ce953a
chore: bump version to 2.1.4
2026-06-13 14:19:39 +10:00
Joel Male
6ba50a1c48
fix: prevent save() on array after clear() with database driver
2026-06-13 14:18:55 +10:00
Joel Male
c50fc70688
fix: restore @mixin and @method PHPDoc on CartFacade for IDE and PHPStan support
2026-06-13 14:17:21 +10:00
Joel Male
c9ffd8b8a4
chore: update to v3.0.0
2026-06-13 14:16:28 +10:00
Joel Male
f3c4ddae6e
docs: add v3 recommended patterns to upgrade guide and link from README
2026-06-13 14:11:20 +10:00
Joel Male
3f1f5fb4d2
fix: add missing return type to getAssociatedModel
2026-06-13 14:09:29 +10:00
Joel Male
2ced1038af
feat: add PHPStan level 5 with zero errors
...
- Install phpstan/phpstan, add phpstan.neon at level 5 targeting PHP 8.3
- Add phpstan-bootstrap.php stubs for Laravel helper functions (app,
config, config_path, app_path, session) unavailable in standalone packages
- Fix CartCondition::setOrder() - removed incorrect @return int (method is void)
- Fix CartCondition::getCalculatedValue() - removed incorrect @return mixed PHPDoc
- Fix Cart::condition() - remove redundant instanceof check the type system already guarantees
- Fix Cart::fireEvent() - remove array_values() on already-list literal array
- Fix ItemCollection - add @property annotations for magic __get properties
- Fix ItemCollection::getAssociatedModel() - correct @return bool to @return mixed
- Fix ItemCollection::getConditions() - remove dead is_array && !instanceof check
- Fix Validator - add @method stub so PHPStan resolves make() through __callStatic
- Add ignoreErrors for trait.unused (HasCart designed for external Livewire use)
- Add ignoreErrors for round() mode mismatch (PHPStan 2.x PHP 8.4 stubs bug)
- Add phpstan step to CI (PHP 8.3 only, matches phpVersion config)
2026-06-06 16:02:16 +10:00
Joel Male
e61ffae5fe
chore: bump version to 2.1.3
2026-05-29 14:27:02 +10:00
Joel Male
10ab30f4e8
fix: correct add() @method signature to accept array input style
2026-05-29 14:14:34 +10:00
Joel Male
34626eef5e
chore: bump version to 2.1.2
2026-05-29 14:12:49 +10:00
Joel Male
2c56062f97
fix: add @mixin and @method PHPDoc to CartFacade for PHPStan/Larastan support
2026-05-29 14:09:15 +10:00
Joel Male
88a118d81b
feat: make SessionDriver constructor args optional with app() defaults
...
new SessionDriver() now works out of the box in a Laravel app, resolving
the session and session ID from the container. Explicit args still work
as before. Also ignores .claude/ directory from version control.
2026-05-28 09:25:41 +10:00
Joel Male
4f87bd645c
docs: update README for v3 features
...
- Fix vendor:publish tag to cart-config
- Update TOC with Storage Drivers, Artisan Generators, First-class Objects, Testing, and Livewire / Inertia sections
- Replace Storage Options section with expanded Storage Drivers section covering session, database, Redis, multi-driver, and custom drivers
- Add Artisan Generators section documenting cart:install, cart:make:coupon, cart:make:tax, cart:make:shipping, cart:make:driver, and cart:debug
- Add First-class Objects section documenting Coupon, TaxRule, and ShippingRate base classes
- Add Testing section documenting Cart::fake() and assertion methods
- Add Livewire / Inertia section documenting HasCart trait and ShareCartWithInertia
2026-05-27 21:53:37 +10:00
Joel Male
bab304c620
docs: add UPGRADE.md and CHANGELOG.md
2026-05-27 21:50:54 +10:00
Joel Male
fd77347542
fix: validate class name input and check file write in Make commands
...
Add path traversal protection via PHP class name regex validation to all
four Make* commands, check file_put_contents() return value for write
failures, and remove the unnecessary \$defer = false property from
CartServiceProvider.
2026-05-27 21:49:08 +10:00
Joel Male
ce51042edf
feat: register Artisan commands in CartServiceProvider
2026-05-27 21:45:16 +10:00
Joel Male
c2b2563cf1
feat: add cart:debug command
2026-05-27 21:44:47 +10:00
Joel Male
15d4397968
feat: add cart:make:driver command
2026-05-27 21:43:59 +10:00
Joel Male
76fba35643
feat: add cart:make:shipping command
2026-05-27 21:43:34 +10:00
Joel Male
b8140166c9
feat: add cart:make:tax command
2026-05-27 21:43:14 +10:00
Joel Male
fc16e6c877
feat: add cart:make:coupon command
2026-05-27 21:42:51 +10:00
Joel Male
731aaa070d
feat: add cart:install command
2026-05-27 21:42:28 +10:00
Joel Male
0efd4378a8
feat: add HasCart trait and ShareCartWithInertia
2026-05-27 21:38:44 +10:00
Joel Male
a485bfb6f0
refactor: use assertEqualsWithDelta for float comparisons, add @internal to fake()
...
Replace Assert::assertEquals with Assert::assertEqualsWithDelta (epsilon 0.0001)
in assertSubTotal, assertTotal, and assertTotalQuantity to avoid IEEE 754
floating-point equality pitfalls. Add @internal docblock to fake() to signal
it is test-only. Add regression test for consecutive withItems calls.
2026-05-27 21:35:49 +10:00
Joel Male
8d04d18b48
test: add withCoupon test and fix withItems ID collision
2026-05-27 21:33:35 +10:00
Joel Male
61863e0bd5
feat: add Cart::fake(), assertion methods, and CartFactory
...
Adds Cart::fake() which swaps the active driver to NullDriver and returns
a CartFactory fluent test builder. Adds assertion methods (assertContains,
assertCount, assertTotalQuantity, assertSubTotal, assertTotal,
assertConditionApplied, assertEmpty, assertNotEmpty) to Cart for use in
tests. CartFactory provides withItems(), withCondition(), and withCoupon()
as chainable helpers for seeding cart state.
2026-05-27 21:31:54 +10:00
Joel Male
c3a734bd7f
feat: add Cart::coupon(), Cart::tax(), Cart::shipping()
...
Proxy methods that accept first-class Coupon, TaxRule, and ShippingRate
objects and delegate to Cart::condition() via toCondition().
2026-05-27 21:27:23 +10:00
Joel Male
2513e07436
feat: add ShippingRate base class
2026-05-27 21:24:44 +10:00
Joel Male
b5edbb8ec0
feat: add TaxRule base class
2026-05-27 21:24:09 +10:00
Joel Male
867daaf328
feat: add Coupon base class
2026-05-27 21:23:39 +10:00
Joel Male
e41739c436
feat: add CartConditionable interface and first-class exceptions
2026-05-27 21:23:07 +10:00
Joel Male
4877911cdd
fix: serialize conditions to arrays before storage; type \$events
...
- serializeConditions() now maps CartCondition objects to arrays via
toArray() before passing to the driver, preventing json_encode()
producing {} for object values in the DatabaseDriver
- Add Dispatcher type hint to \$events property and constructor parameter
- Add database round-trip test for cart-level conditions
- Fix CartConditionsTest to retrieve condition objects from the cart
rather than relying on object-reference side-effects that no longer
hold after proper serialization
2026-05-27 21:21:44 +10:00
Joel Male
f3e5e958b7
fix: resolve Cart.php regressions after driver refactor
...
- Cast \$value to string in updateQuantityRelative() before passing to preg_match() and str_replace() to fix TypeError when integer quantities are passed
- Reconstruct ItemAttributeCollection and CartCondition objects from serialized arrays in getContent() so attribute property access (->size) and condition methods (.getName()) work correctly after deserialization
- Store CartCondition objects directly (not serialized to arrays) in saveConditions() to preserve object identity for parsedRawValue tracking via getCalculatedValue()
- Remove ->values() re-indexing from serializeItems() conditions serialization to preserve original condition array indices after partial removal
2026-05-27 21:16:07 +10:00
Joel Male
adf4bca74f
chore: remove CartSession (replaced by driver system)
2026-05-27 21:09:50 +10:00
Joel Male
0c27ac4d9a
test: update existing tests to use CartDriver
2026-05-27 21:09:40 +10:00
Joel Male
9abf6a7a1b
feat: update CartServiceProvider to use CartManager
2026-05-27 21:08:10 +10:00
Joel Male
e0103aadaa
refactor: update Cart to use CartDriver interface
...
Replace the v2 Cart implementation (which used CartSession directly) with
the v3 design that accepts a CartDriver contract via constructor injection.
Removes validateConfig(), replaces $this->session with $this->driver, adds
getDriver()/extend() helpers, serializes items/conditions through the driver,
and drops the unused setDecimals() method.
2026-05-27 21:06:22 +10:00
Joel Male
90ea8c44e4
fix: correct Redis TTL units in config (seconds not minutes)
2026-05-27 21:03:18 +10:00
Joel Male
3b8fa4c838
feat: update cart config with v3 driver options
2026-05-27 21:02:32 +10:00
Joel Male
2f2d268e0f
feat: add CartManager
2026-05-27 21:02:23 +10:00
Joel Male
71213d51f5
fix: null-safe json_decode in RedisDriver; add getSessionModel test to MultiDriverTest
2026-05-27 21:01:34 +10:00
Joel Male
83aa9a1431
feat: add MultiDriver
2026-05-27 20:59:45 +10:00
Joel Male
1705c23205
feat: add RedisDriver
2026-05-27 20:59:15 +10:00
Joel Male
9fcd50f81f
test: add setSessionKey test to DatabaseDriverTest
2026-05-27 20:58:24 +10:00
Joel Male
4702cf98ab
feat: add DatabaseDriver
...
Implements CartDriver for Eloquent-backed persistence using firstOrNew
pattern. Includes 9 unit tests covering CRUD, flush, clearItems, and
model retrieval.
2026-05-27 20:55:01 +10:00
Joel Male
8927ef08a0
fix: guard null writes in SessionDriver::setSessionKey
2026-05-27 20:53:19 +10:00
Joel Male
c9f48d7e88
feat: add SessionDriver
2026-05-27 20:50:47 +10:00
Joel Male
11e23a946e
test: fix strict_types and test name in NullDriverTest
2026-05-27 20:49:36 +10:00
Joel Male
b3c4c53e63
feat: add NullDriver
2026-05-27 20:47:14 +10:00
Joel Male
c9f3d76366
feat: add CartDriver interface
2026-05-27 20:46:48 +10:00
Joel Male
b2a4864675
chore: ignore docs/superpowers/
2026-05-27 20:22:32 +10:00
Joel Male
aaa3360d1f
chore: add test bootstrap, update phpunit config, and add Laravel 13 support to README
...
- Add tests/bootstrap.php to suppress PHP 8.4 vendor deprecation notices (Mockery implicit-nullable)
- Update phpunit.xml.dist to reference bootstrap, use PHPUnit 11.5 schema, and ignore indirect deprecations
- Note Laravel 13 support in README
2026-05-27 19:50:09 +10:00
Joel Male
05729b7865
chore: bump version to 2.1.1
2026-05-27 16:42:52 +10:00
Joel Male
17532f1b05
chore(deps-dev): bump pestphp/pest from 3.x-dev to 4.7.0
...
Resolves merge conflict with laravel/pint update - regenerated lock file
to include both pint 1.29.1 and pest 4.7.0 with all dependencies.
2026-05-27 16:42:16 +10:00
Joel Male
fcdd356718
fix: update CI runner from deprecated ubuntu-20.04 to ubuntu-latest
2026-05-27 16:40:41 +10:00
Joel Male
e0d566cebd
chore: pin GitHub Actions to full commit SHAs
...
Pins all GitHub Actions uses: references to full commit SHAs
to prevent supply chain attacks via mutable action tags.
Original tag references are kept as inline comments.
2026-05-27 14:46:49 +10:00
Joel Male
6638f812c8
chore: bump version to 2.1.0
2026-03-24 14:06:08 +10:00
Joel Male
8f442f51e0
chore: migrate to wearepixel/laravel-cart
2026-03-24 14:04:48 +10:00
Joel Male
6dfd0ce761
chore: bump version to 2.0.0
2026-03-23 16:30:38 +10:00
Joel Male
a3161888aa
chore: bump to v2.0.0 with PHP 8.3+ support and invalid item cleanup
2026-03-23 16:28:53 +10:00
Joel Male
4c02310bf7
feat: rough session re-implementation
2025-04-14 16:53:35 +10:00
Joel Male
e810eb4ef4
Merge pull request #2 from joelwmale/feature/database-support
...
Database Support
2025-02-25 16:55:44 +10:00
Joel Male
4cf078277d
feat: finish tests & docs
2025-02-25 16:54:03 +10:00
Joel Male
7adf5ecd1f
feat: add tests and fix item level conditions for database storage
2025-02-25 16:31:42 +10:00
Joel Male
158cf38f14
feat: update composer deps & version
2025-02-25 16:08:27 +10:00
Joel Male
0f07b9ae8a
feat: database support
2025-02-25 16:03:17 +10:00
Joel Male
ec99aa0563
feat: clean up and starting documentation
2025-02-25 14:53:49 +10:00
Joel Male
8d6e1bcc26
wip: readme updates
2025-02-25 13:49:09 +10:00
Joel Male
b92dce9ca4
wip: initial working database support
2025-02-25 11:47:10 +10:00
Joel Male
2196f58f01
Merge pull request #1 from joelwmale/feature/laravel-12.x-support
...
Laravel 12.x Support
2025-02-25 08:57:01 +10:00
Joel Male
ed4d112665
Laravel 12.x Support
2025-02-25 08:54:04 +10:00
Joel Male
f60bf92157
1.0.12
2024-11-28 13:11:23 +10:00
Joel Male
a231ed8c43
1.0.12
2024-11-28 13:06:30 +10:00
Joel Male
599051631c
wip: rename package to joelwmale
2024-11-28 13:06:24 +10:00
Joel Male
b3ef4c38fc
1.0.11
2024-09-23 07:48:27 +10:00
Joel Male
a45121ca63
Merge pull request #20 from wearepixel/task/fix-subtotal-always-being-used-if-the-total-is-$0
...
Task: Fix subtotal always being used when cart conditions on the total bring it to $0
2024-09-23 07:48:06 +10:00
Joel Male
5505f121c7
fix subtotal always being used
2024-09-23 07:45:59 +10:00
Joel Male
472d505041
wip: fix issue with conditions not being properly removed
2024-09-18 15:56:12 +10:00
Joel Male
c6c4240c5f
1.0.9
2024-09-08 18:27:44 +10:00
Joel Male
54d7c8a54f
Merge pull request #17 from wearepixel/feature/livewire-support-for-nested-collections
...
Better Livewire Support
2024-09-08 12:23:22 +10:00
Joel Male
a8d743eb9b
remove php formatting
2024-09-08 12:22:03 +10:00
Joel Male
d4d4df7d58
pint fixes
2024-09-08 12:20:36 +10:00
Joel Male
7a2c41e02d
add better livewire support
...
- and reset collection indexes properly
2024-09-08 08:32:51 +10:00
Joel Male
9a59857825
Merge pull request #12 from wearepixel/feature/targets-to-activate-cart-conditions
...
Feature: Add targets to cart conditions
2024-09-04 09:38:34 +10:00
Joel Male
43238b6f2e
revert php 8.0 support
2024-09-04 09:33:49 +10:00
Joel Male
c0f0fcd2f0
fix 8.0 tests
2024-09-04 09:30:28 +10:00
Joel Male
185c4572ae
fix tests
2024-09-04 09:26:50 +10:00
Joel Male
ab9eb6c873
fix tests
2024-09-04 09:16:15 +10:00
Joel Male
7ee26add8d
undo extra changes
2024-09-04 09:14:23 +10:00
Joel Male
05318b7b13
working on deprecations and code cleanup
2024-09-03 21:41:45 +10:00
Joel Male
4d2efcdeae
fix tests for cart conditions
2024-09-03 21:07:58 +10:00
Joel Male
a269c188e4
initial functionality
2024-09-03 20:22:03 +10:00
Joel Male
2ccba20119
1.0.8
2024-08-30 10:08:47 +10:00
Joel Male
313a4f7aa2
Revert "1.0.7"
...
This reverts commit 4a312a37e2 .
2024-08-30 10:08:27 +10:00
Joel Male
4a312a37e2
1.0.7
2024-08-30 09:44:40 +10:00