PHPackages                             veltix/laravel-montonio - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. veltix/laravel-montonio

ActiveLibrary[Payment Processing](/categories/payments)

veltix/laravel-montonio
=======================

Laravel integration for the Montonio Payments and Shipping APIs

v1.0.1(2mo ago)031MITPHPPHP ^8.3

Since Feb 24Pushed 2mo agoCompare

[ Source](https://github.com/veltix/laravel-montonio)[ Packagist](https://packagist.org/packages/veltix/laravel-montonio)[ RSS](/packages/veltix-laravel-montonio/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (16)Versions (3)Used By (0)

Laravel Montonio
================

[](#laravel-montonio)

Laravel integration for the [Montonio](https://montonio.com) Payments and Shipping APIs.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 11, 12, or 13

Installation
------------

[](#installation)

```
composer require veltix/laravel-montonio
```

Run the install command to publish the config and migrations:

```
php artisan montonio:install
```

If you plan to use your own database tables and models, skip migrations during install:

```
php artisan montonio:install --skip-migrations
```

Add your API credentials to `.env`:

```
MONTONIO_ACCESS_KEY=your-access-key
MONTONIO_SECRET_KEY=your-secret-key
MONTONIO_ENVIRONMENT=sandbox
```

Run the migrations and sync methods from the Montonio API:

```
php artisan migrate
php artisan montonio:sync-methods
```

Configuration
-------------

[](#configuration)

Publish the config file manually (the install command does this automatically):

```
php artisan vendor:publish --tag=montonio-config
```

### Environment variables

[](#environment-variables)

VariableDefaultDescription`MONTONIO_ACCESS_KEY``''`Your Montonio API access key`MONTONIO_SECRET_KEY``''`Your Montonio API secret key`MONTONIO_ENVIRONMENT``sandbox`API environment (`sandbox` or `production`)`MONTONIO_TIMEOUT``30`HTTP request timeout in seconds`MONTONIO_MIGRATIONS_ENABLED``true`Load the package's migrations`MONTONIO_SYNC_COMMANDS_ENABLED``true`Register the `montonio:sync-methods` command`MONTONIO_CACHE_ENABLED``true`Enable caching for payment/shipping methods`MONTONIO_CACHE_TTL``3600`Cache time-to-live in seconds`MONTONIO_WEBHOOK_ROUTE``/montonio/webhook`Webhook endpoint path`MONTONIO_WEBHOOK_QUEUE``null`Queue name for async webhook processingUsage
-----

[](#usage)

### Facade

[](#facade)

Access the Montonio API clients through the `Montonio` facade:

```
use Veltix\LaravelMontonio\Facades\Montonio;

// Payments API
$paymentsClient = Montonio::payments();

// Shipping API
$shippingClient = Montonio::shipping();

// Webhook verifier
$webhookVerifier = Montonio::webhooks();
```

### Syncing methods

[](#syncing-methods)

Sync payment and shipping methods from the Montonio API:

```
# Sync both payment and shipping methods
php artisan montonio:sync-methods

# Sync only payment methods
php artisan montonio:sync-methods --payments-only

# Sync only shipping methods
php artisan montonio:sync-methods --shipping-only
```

### Querying methods

[](#querying-methods)

Use the `PaymentMethod` and `ShippingMethod` Eloquent models to query synced methods:

```
use Veltix\LaravelMontonio\Models\PaymentMethod;
use Veltix\LaravelMontonio\Models\ShippingMethod;

// Get all active payment methods
$methods = PaymentMethod::active()->get();

// Get all active shipping methods
$methods = ShippingMethod::active()->get();
```

For cached queries, use the `MethodCacheService`:

```
use Veltix\LaravelMontonio\Services\MethodCacheService;

$cache = app(MethodCacheService::class);

$paymentMethods = $cache->paymentMethods();
$shippingMethods = $cache->shippingMethods();
```

Webhooks
--------

[](#webhooks)

The package automatically registers a `POST` route at `/montonio/webhook` (configurable via `MONTONIO_WEBHOOK_ROUTE`). The controller detects whether the incoming webhook is a payment or shipping notification and dispatches the appropriate event.

### Events

[](#events)

**Payment webhook:**

EventPayload`PaymentWebhookReceived``PaymentWebhookPayload`**Shipping webhooks:**

EventPayload`ShipmentRegistered``ShippingWebhookPayload``ShipmentRegistrationFailed``ShippingWebhookPayload``ShipmentStatusUpdated``ShippingWebhookPayload``ShipmentLabelsCreated``ShippingWebhookPayload``LabelFileReady``ShippingWebhookPayload``LabelFileCreationFailed``ShippingWebhookPayload`All events live in the `Veltix\LaravelMontonio\Events` namespace.

### Listening to events

[](#listening-to-events)

Register listeners in your `EventServiceProvider` or use Laravel's event discovery:

```
use Veltix\LaravelMontonio\Events\PaymentWebhookReceived;
use Veltix\LaravelMontonio\Events\ShipmentStatusUpdated;

class EventServiceProvider extends ServiceProvider
{
    protected $listen = [
        PaymentWebhookReceived::class => [
            HandlePaymentWebhook::class,
        ],
        ShipmentStatusUpdated::class => [
            HandleShipmentUpdate::class,
        ],
    ];
}
```

Each event has a `public PaymentWebhookPayload|ShippingWebhookPayload $payload` property containing the verified webhook data.

### Queued webhooks

[](#queued-webhooks)

To process webhooks asynchronously, set the queue name:

```
MONTONIO_WEBHOOK_QUEUE=montonio
```

When set, the controller immediately responds with `202` and dispatches a `ProcessMontonioWebhook` job onto the specified queue. The job verifies the token and fires the appropriate event.

### Webhook middleware

[](#webhook-middleware)

Add middleware to the webhook route via the config:

```
// config/montonio.php
'webhooks' => [
    'middleware' => ['api', App\Http\Middleware\VerifyIpWhitelist::class],
],
```

Customization
-------------

[](#customization)

### Custom models

[](#custom-models)

By default the package provides `PaymentMethod` and `ShippingMethod` Eloquent models backed by their own migrations. If your application already has payment or shipping method tables, you can swap the models the package uses at runtime.

1. Disable the package's migrations and sync commands:

```
MONTONIO_MIGRATIONS_ENABLED=false
MONTONIO_SYNC_COMMANDS_ENABLED=false
```

2. Point the config at your own models:

```
// config/montonio.php
'models' => [
    'payment_method' => App\Models\PaymentMethod::class,
    'shipping_method' => App\Models\ShippingMethod::class,
],
```

The sync actions, cache service, and everything else in the package will use your models instead.

### Extending the default models

[](#extending-the-default-models)

If you only need to add relationships or change the table name, extend the package's models instead of writing your own from scratch:

```
use Veltix\LaravelMontonio\Models\PaymentMethod as BasePaymentMethod;

class PaymentMethod extends BasePaymentMethod
{
    protected $table = 'my_payment_methods';

    public function orders(): HasMany
    {
        return $this->hasMany(Order::class);
    }
}
```

Then register it in the config:

```
'models' => [
    'payment_method' => App\Models\PaymentMethod::class,
],
```

### Disabling the sync command

[](#disabling-the-sync-command)

Set `MONTONIO_SYNC_COMMANDS_ENABLED=false` to prevent the `montonio:sync-methods` command from being registered. This is useful when you want to write your own sync logic while still using the rest of the package.

Caching
-------

[](#caching)

The `MethodCacheService` caches active payment and shipping methods using Laravel's cache system. Configure caching with:

```
MONTONIO_CACHE_ENABLED=true
MONTONIO_CACHE_TTL=3600
```

Set `MONTONIO_CACHE_ENABLED=false` to disable caching and query the database directly.

Cache keys used: `montonio:payment_methods` and `montonio:shipping_methods`.

Custom HTTP client
------------------

[](#custom-http-client)

The package uses [Guzzle](https://docs.guzzlephp.org) by default. To use a custom PSR-18 HTTP client, bind the PSR interfaces in a service provider:

```
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;

$this->app->bind(ClientInterface::class, fn () => new MyCustomClient());
$this->app->bind(RequestFactoryInterface::class, fn () => new MyRequestFactory());
$this->app->bind(StreamFactoryInterface::class, fn () => new MyStreamFactory());
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance84

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

83d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2bc1d8551638205f4ec624ec9bd3619e16f0dd94baa576246eaf90d08f631c8?d=identicon)[Veltix](/maintainers/Veltix)

---

Top Contributors

[![veltix](https://avatars.githubusercontent.com/u/46252663?v=4)](https://github.com/veltix "veltix (3 commits)")

---

Tags

laravelpaymentsshippingmontonio

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/veltix-laravel-montonio/health.svg)

```
[![Health](https://phpackages.com/badges/veltix-laravel-montonio/health.svg)](https://phpackages.com/packages/veltix-laravel-montonio)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[flat3/lodata

OData v4.01 Producer for Laravel

96320.9k](/packages/flat3-lodata)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[asciisd/knet

Knet package is provides an expressive, fluent interface to KNet's payment services.

141.1k](/packages/asciisd-knet)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
