1. Go to this page and download the library: Download veltix/laravel-montonio library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
veltix / laravel-montonio example snippets
use Veltix\LaravelMontonio\Facades\Montonio;
// Payments API
$paymentsClient = Montonio::payments();
// Shipping API
$shippingClient = Montonio::shipping();
// Webhook verifier
$webhookVerifier = Montonio::webhooks();
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();
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);
}
}
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());