Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Library Laravel Package

myfatoorah/library

PHP library for integrating MyFatoorah payment gateway. Create invoices, execute and verify payments, handle callbacks, and manage payment status in your Laravel or PHP app with a simple API wrapper and configuration options.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Modularity: The package appears to be a dedicated PHP/Laravel SDK for MyFatoorah’s payment gateway, aligning well with Laravel’s service-oriented architecture. It abstracts API interactions (e.g., invoicing, refunds, webhooks), reducing custom integration complexity.
  • Laravel Compatibility: Designed for Laravel (via service providers, facades, and config), it integrates seamlessly with Laravel’s dependency injection and event systems (e.g., webhook listeners).
  • Domain-Specific: Focuses on e-commerce/payment workflows, making it ideal for SaaS platforms, marketplaces, or B2B applications requiring invoicing/refunds.
  • Microservices Fit: If adopting a modular monolith or microservices approach, this package could be containerized as a standalone service (e.g., payment-service) with Laravel’s HTTP clients.

Integration Feasibility

  • API Abstraction: Eliminates direct API calls, reducing boilerplate and improving maintainability.
  • Webhook Support: Built-in webhook handling (via Laravel events) simplifies asynchronous payment status updates.
  • Configuration-Driven: Centralized config (e.g., config/myfatoorah.php) aligns with Laravel’s 12-factor principles.
  • Testing: Mockable HTTP clients (e.g., Guzzle) enable unit/integration testing without external dependencies.

Technical Risk

  • Vendor Lock-in: Tight coupling to MyFatoorah’s API may require refactoring if switching providers (e.g., to Stripe or PayPal).
  • Versioning: No visible semantic versioning or changelog in the repo; risk of breaking changes in updates.
  • Documentation Gaps: Limited stars/dependents suggest undocumented edge cases (e.g., retry logic, error handling).
  • Performance: Unknown overhead for high-volume transactions (e.g., batch invoicing). Benchmarking recommended.
  • Security: Assess if the package handles PCI compliance (e.g., tokenization, sensitive data storage) or delegates to MyFatoorah.

Key Questions

  1. Use Case Alignment:
    • Does the package support all required payment flows (e.g., subscriptions, multi-currency, delayed payments)?
    • Are there gaps for custom fields or business-specific metadata in invoices?
  2. Error Handling:
    • How are idempotency keys, rate limits, and retry mechanisms managed?
    • Are there Laravel exceptions for API failures (e.g., MyFatoorahException)?
  3. Webhooks:
    • Can webhooks be validated (e.g., HMAC signatures) and replayed safely?
    • Is there support for webhook retries or dead-letter queues?
  4. Testing:
    • Are there pre-built test doubles (e.g., MyFatoorahMock) for CI/CD?
    • How is API response validation handled (e.g., JSON Schema)?
  5. Scaling:
    • Does the package support async processing (e.g., queues for refunds)?
    • Are there connection pooling optimizations for high-throughput APIs?
  6. Compliance:
    • Does it meet GDPR/PSD2 requirements for data handling?
    • Is audit logging built-in for sensitive operations?

Integration Approach

Stack Fit

  • Laravel Core: Leverage Laravel’s:
    • Service Providers (MyFatoorahServiceProvider) for bootstrapping.
    • Facades (MyFatoorah::invoice()) for clean syntax.
    • Events (InvoiceCreated, RefundFailed) for decoupled workflows.
    • Queues (dispatch(new ProcessRefund)) for async operations.
  • Testing Stack:
    • Pest/PHPUnit: Mock HttpClient (e.g., Mockery or Laravel’s Http facade).
    • Factories: Generate test invoices/refunds.
  • Monitoring:
    • Laravel Horizon: Track webhook processing.
    • Sentry/Loggly: Log API errors and retries.

Migration Path

  1. Discovery Phase:
    • Audit existing payment logic (e.g., custom API calls, manual webhook handlers).
    • Map features to package capabilities (e.g., "Do we need subscriptions?").
  2. Pilot Integration:
    • Replace one endpoint (e.g., invoice creation) with the package.
    • Use feature flags to toggle between old/new code.
  3. Webhook Transition:
    • Migrate from custom webhook listeners to the package’s event system.
    • Implement dual-write during transition (old + new listeners).
  4. Deprecation:
    • Phase out legacy API calls post-validation.

Compatibility

  • Laravel Versions: Confirm compatibility with your Laravel LTS (e.g., 10.x, 11.x).
  • PHP Versions: Ensure PHP 8.1+ support (if using named arguments, attributes).
  • Database: No DB schema changes, but ensure config/database.php aligns with your ORM (e.g., Eloquent).
  • Third-Party:
    • Cashier/Venue: If using Laravel Cashier, assess conflicts (e.g., duplicate webhooks).
    • Queue Workers: Ensure queue drivers (e.g., Redis, database) support async operations.

Sequencing

Phase Task Dependencies
Setup Install package, publish config (php artisan vendor:publish). Laravel project initialized.
Configuration Configure .env (API keys, endpoints). MyFatoorah merchant credentials.
Core API Replace invoice/refund logic with package methods. Basic API flows tested.
Webhooks Migrate listeners to Laravel events + package webhook handlers. Webhook URLs verified.
Async Implement queues for long-running operations (e.g., refunds). Queue workers configured.
Testing Write integration tests for critical paths. Test data seeded.
Monitoring Set up logging/metrics for API calls and webhooks. Observability tools in place.
Rollout Feature flag rollout; monitor errors. Pilot environment validated.

Operational Impact

Maintenance

  • Proactive:
    • Dependency Updates: Monitor MyFatoorah’s API changes; update package via composer update.
    • Config Management: Centralize .env and config/myfatoorah.php in a secrets manager (e.g., Vault).
    • Backward Compatibility: Deprecate old API calls gradually (e.g., via @deprecated tags).
  • Reactive:
    • API Breaking Changes: Maintain a runbook for MyFatoorah API deprecations.
    • Package Bugs: Contribute fixes or fork if upstream is unresponsive.

Support

  • Troubleshooting:
    • Logs: Enable MYFATOORAH_LOG=true in .env for debug traces.
    • Error Tracking: Correlate API errors with Laravel logs (e.g., request_id).
  • SLA Impact:
    • Downtime: MyFatoorah’s uptime affects your payment flows; design fallback mechanisms (e.g., queue failed jobs).
    • Response Time: Benchmark API latency under load (e.g., 1000 invoices/min).
  • Customer Support:
    • Disputes: Document how to reconcile MyFatoorah’s reports with your system.
    • Refunds: Ensure support teams can trigger refunds via Laravel Tinker or admin panel.

Scaling

  • Horizontal Scaling:
    • Stateless Design: The package is stateless; scale Laravel workers independently.
    • Queue Throttling: Use Laravel’s afterCommit() to batch queue jobs (e.g., 100 refunds/second).
  • Vertical Scaling:
    • Memory: Profile memory_get_usage() during high-volume API calls.
    • Database: Optimize invoice table indexes if storing MyFatoorah responses.
  • Cost:
    • API Calls: MyFatoorah may charge per transaction; monitor usage via their dashboard.
    • Webhooks: Ensure your server can handle spike traffic (e.g., 1000 webhooks/min).

Failure Modes

Failure Scenario Mitigation Strategy Detection Mechanism
MyFatoorah API Downtime Queue failed jobs; retry with exponential backoff. Laravel Horizon + Sentry alerts.
Webhook Delivery Failures Implement dead-letter queues for unprocessed webhooks. Queue worker metrics.
Rate Limiting Add circuit breakers (e.g., spatie/flysystem-circuit-breaker). HTTP 429 responses logged.
Data Corruption Validate
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony