PHPackages                             alazzi-az/laravel-tamara - 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. [API Development](/categories/api)
4. /
5. alazzi-az/laravel-tamara

ActiveLibrary[API Development](/categories/api)

alazzi-az/laravel-tamara
========================

Laravel wrapper for Tamara SDK

v1.2.0(2y ago)11905↓42.9%7[3 PRs](https://github.com/alazzi-az/laravel-tamara/pulls)MITPHPPHP ^8.1CI passing

Since Jul 3Pushed 1y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (15)Versions (7)Used By (0)

Laravel wrapper for [Tamara SDK](https://github.com/tamara-solution/php-sdk)
============================================================================

[](#laravel-wrapper-for-tamara-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/447248ba76a7f519acb2e75b6736fa44fdc04926b4666267f74b4d87494616d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c617a7a692d617a2f6c61726176656c2d74616d6172612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alazzi-az/laravel-tamara)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8a244b677b23885f44a44b440a7b7d65a48659eebf5f26abf59ceeb4d2443048/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616c617a7a692d617a2f6c61726176656c2d74616d6172612f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/alazzi-az/laravel-tamara/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/23b8a2ed6fb284d950059fc42f8f5259abb58425198b03137c0c2ab1b7ab2c04/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616c617a7a692d617a2f6c61726176656c2d74616d6172612f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/alazzi-az/laravel-tamara/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/4e459e57e5d4478aba0bd7fb5170533396bc4bbe6ec7569dc68c5b62a10292bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c617a7a692d617a2f6c61726176656c2d74616d6172612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alazzi-az/laravel-tamara)

Laravel wrapper for Tamara SDK with small amount of changes to make it work with Laravel 9.x.

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

[](#installation)

You can install the package via composer:

```
composer require alazzi-az/laravel-tamara
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-tamara-config"
```

This is the contents of the published config file:

```
return [
    'uri' => env('TAMARA_URI', 'https://api-sandbox.tamara.co'),
    'token' => env('TAMARA_TOKEN', ''),
    'notification_token' => env('TAMARA_NOTIFICATION_TOKEN', ''),
    'request_timeout' => env('TAMARA_REQUEST_TIMEOUT', 1000),
    'transport' => null,
    'success_url' =>  env('APP_URL').'/tamara_handle_success_redirect',
    'failure_url' =>  env('APP_URL').'/tamara_handle_failure_redirect',
    'cancel_url' =>  env('APP_URL').'/tamara_handle_cancel_redirect',
    'notification_url' =>  env('APP_URL').'/tamara_notification_redirect',
];
```

Usage For Client Instance
-------------------------

[](#usage-for-client-instance)

```
use \AlazziAz\Tamara\Facades\Tamara;

$client = \AlazziAz\Tamara\Facades\Tamara::client();
$response = $client->getPaymentTypes('SA');
```

Create Order Checkout
---------------------

[](#create-order-checkout)

```
use \AlazziAz\Tamara\Facades\Tamara;
use \AlazziAz\Tamara\Tamara\Model\Order\MerchantUrl;
use \AlazziAz\Tamara\Tamara\Model\Order\OrderItemCollection;
use \AlazziAz\Tamara\Tamara\Model\Order\Order;
use \AlazziAz\Tamara\Tamara\Model\Order\OrderItem;
use AlazziAz\Tamara\Tamara\Request\Checkout\CreateCheckoutRequest;
use \AlazziAz\Tamara\Tamara\Model\Order\Consumer;
use AlazziAz\Tamara\Tamara\Model\Money;
use AlazziAz\Tamara\Tamara\Model\Order\Address;

$merchantUrl = app()->make(MerchantUrl::class);
$order = new Order();
$order->setMerchantUrl($merchantUrl);
$orderItemCollection = new OrderItemCollection();
$client = Tamara::client();

// firs set  Order Details
$order->setOrderReferenceId($orderReferenceId);
$order->setLocale($local);
$order->setCurrency($orderCurrency);
$order->setTotalAmount(new Money($totalAmount, $orderCurrency));
$order->setCountryCode($countryCode);
$order->setPaymentType($paymentType);
$order->setDescription($orderDescription);
$order->setTaxAmount(new Money($taxAmount, $orderCurrency));
$order->setDiscount(new Discount($discountType, new Money($discountAmount, $orderCurrency)));
$order->setShippingAmount(new Money($shippingAmount, $orderCurrency));

// second set Consumer data
$consumer = new Consumer();
$consumer->setFirstName($firstName);
$consumer->setLastName($lastName);
$consumer->setEmail($email);
$consumer->setPhoneNumber($phoneNumber);
$order->setConsumer($consumer);

// third sett Billing Address
$address = new Address();
$address->setFirstName($firstName);
$address->setLastName($lastName);
$address->setLine1($line1);
$address->setLine2($line2);
$address->setRegion($region);
$address->setCity($city);
$address->setPhoneNumber($phoneNumber);
$address->setCountryCode($countryCode);
$order->setBillingAddress($address);

// forth set Shipping Address
$address = new Address();
$address->setFirstName($firstName);
$address->setLastName($lastName);
$address->setLine1($line1);
$address->setLine2($line2);
$address->setRegion($region);
$address->setCity($city);
$address->setPhoneNumber($phoneNumber);
$address->setCountryCode($countryCode);
$order->setShippingAddress($address);

// fifth we add items to items collection
$orderItem = new OrderItem();
$orderItem->setName($name);
$orderItem->setQuantity($quantity);
$orderItem->setUnitPrice(new Money($unitPrice, $currency));
$orderItem->setType($type);
$orderItem->setTotalAmount(new Money($totalPrice, $currency));
$orderItem->setTaxAmount(new Money($taxAmount, $currency));
$orderItem->setDiscountAmount(new Money($discount, $currency));
$orderItem->setReferenceId($uniqueId);
$orderItem->setSku($uniqueId);
if ($imageUrl) {
    $orderItem->setImageUrl($imageUrl);
}

// append items can be in iterator
$orderItemCollection->append($orderItem);

// sixth set items collection to order
$order->setItems($this->orderItemCollection);

// seventh  create request object
$request = new CreateCheckoutRequest($this->order);

// now we can make request

$response = $client->createCheckout($request);

// get data from response
$checkoutUrl=$response->getCheckoutResponse()->getCheckoutUrl(); // redirect customer to complete payment
$orderID=$response->getCheckoutResponse()->getOrderId();
$heckOutID=$response->getCheckoutResponse()->getCheckoutId();
```

After Customer complete payment we need to Authorise Order Transaction
----------------------------------------------------------------------

[](#after-customer-complete-payment-we-need-to-authorise-order-transaction)

### in controller that handle success\_url endpoint

[](#in-controller-that-handle-success_url-endpoint)

```
use AlazziAz\Tamara\Tamara\Request\Order\AuthoriseOrderRequest;
use AlazziAz\Tamara\Facades\Tamara;

  $authOrder = new AuthoriseOrderRequest($request->get('orderId'));
  $authedResponse = Tamara::client()->authoriseOrder($authOrder);
  $orderStatus=$authedResponse->getOrderStatus(); // authorised, approved, captured, fully_captured, declined, refunded, failed, expired
// then check the status of the order and update your app state
```

#### you can Capture payment by using AlazziAz\\Tamara\\Tamara\\Request\\Payment\\CaptureRequest

[](#you-can-capture-payment-by-using-alazziaztamaratamararequestpaymentcapturerequest)

Usage For Notification Service Instance
---------------------------------------

[](#usage-for-notification-service-instance)

```
use AlazziAz\Tamara\Facades\Tamara;

$notificationService = Tamara::notificationService();
$message = $notificationService->processAuthoriseNotification();
// then you can update state of the app e.g.
$orderId=$message->getOrderReferenceId();
$orderStatus=$message->getOrderStatus();
//...
```

Usage Some Instance by Laravel Container to get the instance injected config values
-----------------------------------------------------------------------------------

[](#usage-some--instance-by-laravel-container-to-get-the-instance-injected-config-values)

```
use Illuminate\Support\Facades\App;
use AlazziAz\Tamara\Tamara\Model\Order\MerchantUrl;

$merchantUrl = App::make(MerchantUrl::class); // app()->make(MerchantUrl::class);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/alazzi-az/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mohammed Ali Azman](https://github.com/alazzi-az)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.5% 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 ~6 days

Total

3

Last Release

1038d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/750a1566a9f2ed8de9e8da9fee372b4426d7585bfdabdb65a1932a40e409a3e3?d=identicon)[alazzi](/maintainers/alazzi)

---

Top Contributors

[![mohammedazman](https://avatars.githubusercontent.com/u/56982649?v=4)](https://github.com/mohammedazman "mohammedazman (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")[![200-0K](https://avatars.githubusercontent.com/u/38166228?v=4)](https://github.com/200-0K "200-0K (1 commits)")

---

Tags

laravelalazzi-azlaravel-tamara

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alazzi-az-laravel-tamara/health.svg)

```
[![Health](https://phpackages.com/badges/alazzi-az-laravel-tamara/health.svg)](https://phpackages.com/packages/alazzi-az-laravel-tamara)
```

###  Alternatives

[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

208.8k](/packages/njoguamos-laravel-plausible)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)

PHPackages © 2026

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