safemood/discountify
Laravel package for dynamic, condition-based discounts. Define custom conditions, apply percentage discounts, set global discount and tax rate, support coupon and class-based discounts, dynamic item field names, optional condition skipping, and event tracking for e-commerce totals.
Strengths:
ConditionInterface implementations, enabling custom logic without core modifications.DiscountAppliedEvent).discountify.php) for field mappings, tax rates, and event toggles, adhering to Laravel’s 12-factor principles.Gaps:
Pros:
Discountify, Condition, Coupon) and service providers for clean integration.discountify:condition generator reduces boilerplate for class-based conditions.price → amount) via config or runtime overrides.Cons:
storage_path('app/discountify/coupons.json')), which may need migration to a database table for production use.Critical:
usageLimit). Mitigation: Use database transactions or Redis atomic operations.price, quantity). Mitigation: Validate input schemas or extend with custom field mappers.Moderate:
DiscountAppliedEvent) may fail silently if listeners throw exceptions. Mitigation: Implement retry logic or dead-letter queues.slug parameter in define()) may require refactoring. Mitigation: Feature flags for deprecated methods.Low:
Scalability Needs:
Discount Complexity:
Integration Points:
Testing Strategy:
Future-Proofing:
Laravel Ecosystem:
Non-Laravel Considerations:
Assessment Phase:
Pilot Integration:
composer require, publish config).Condition::define().Full Rollout:
Discountify for non-critical paths (e.g., admin discounts).DiscountAppliedEvent) are wired to analytics.json, fileinfo, and mbstring (standard in Laravel).coupons table with code, discount, usage_count).discount parameter).Pre-requisites:
Core Integration:
AppServiceProvider (or a dedicated DiscountServiceProvider).Coupon Setup:
CheckCouponUsage).Event Listeners:
DiscountAppliedEvent and CouponAppliedEvent (e.g., log discounts to a discounts table).Testing:
ConditionInterface).Monitoring:
Pros:
AppServiceProvider or condition classes), reducing technical debt.Cons:
Strengths:
jackbayliss).discounts table).Challenges:
OrderTotalDiscount classHow can I help you explore Laravel packages today?