PHPackages                             wingly/pwinty - 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. wingly/pwinty

AbandonedArchivedLibrary[API Development](/categories/api)

wingly/pwinty
=============

A laravel package to work with pwinty image printing API

1.2.0(4y ago)83.2k1[1 PRs](https://github.com/Wingly-Company/pwinty/pulls)MITPHPPHP ^7.4|^8.0

Since Sep 10Pushed 4y agoCompare

[ Source](https://github.com/Wingly-Company/pwinty)[ Packagist](https://packagist.org/packages/wingly/pwinty)[ Docs](https://github.com/Wingly-Company/pwinty)[ RSS](/packages/wingly-pwinty/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

Pwinty
======

[](#pwinty)

[![tests](https://github.com/Wingly-Company/pwinty/workflows/tests/badge.svg)](https://github.com/Wingly-Company/pwinty/workflows/tests/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/bf7cdec48ee0f213f5ece025143651927e2bf54d5903d6578e97aeb90a503407/68747470733a2f2f706f7365722e707567782e6f72672f77696e676c792f7077696e74792f76)](//packagist.org/packages/wingly/pwinty)[![License](https://camo.githubusercontent.com/690bf503565934aa509df0b23d0c86f580e168dbfa66937c4bad87660bc9eb3e/68747470733a2f2f706f7365722e707567782e6f72672f77696e676c792f7077696e74792f6c6963656e7365)](//packagist.org/packages/wingly/pwinty)[![StyleCI](https://camo.githubusercontent.com/2380a092f208437d0bd7025ba0c2873845f58f76803873f7b75711d76bfbc348/68747470733a2f2f7374796c6563692e696f2f7265706f732f3237323434373939322f736869656c64)](https://styleci.io/repos/272447992)[![Total Downloads](https://camo.githubusercontent.com/4aed1ef8639eaef01e24fc50bc97ce59cc41e83110dbe1e4012887ee6debffbb/68747470733a2f2f706f7365722e707567782e6f72672f77696e676c792f7077696e74792f646f776e6c6f616473)](//packagist.org/packages/wingly/pwinty)

This package makes working with [Pwinty](https://pwinty.com) image-printing API in Laravel applications a breeze. You can place orders, add images and submit them for shipping. You can also subscribe to Pwinty webhooks after you configure your callback URL at the Pwinty dashboard.

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

[](#installation)

You can install this package through composer.

```
composer require wingly/pwinty
```

Usage
-----

[](#usage)

### Database migrations

[](#database-migrations)

The Pwinty service provider registers it's own database migrations, so make sure that you run your migrations after installing the package. A new orders table will be created to hold all your users orders.

```
php artisan migrate
```

### Pwinty environment setup

[](#pwinty-environment-setup)

You need to configure your Pwinty API key and merchant ID in your `.env` file.

```
PWINTY_APIKEY=your_pwinty_key
PWINTY_MERCHANT=your_pwinty_merchant_id

```

You should also set the API environment to be either "sandbox" or "production"

```
PWINTY_API=sandbox

```

### Working with orders

[](#working-with-orders)

Add the Orderer trait to your model. The trait provides methods to create and retrieve orders easily.

```
use Wingly\Pwinty\Orderer;

class User extends Authenticatable
{
    use Orderer;
}
```

By default the `App\User` model is used. You can change this by specifying a different model in your `.env` file.

```
PWINTY_MODEL=App\User

```

#### Creating orders

[](#creating-orders)

To create a new order first retrieve an instance of your orderer model and use the `newOrder` method to create an order. This method will return you an instance of the `OrderBuilder` where you can set your order parameters. You should finish the order by calling the `create` method last. Check the [Pwinty documentation](https://pwinty.com/api/) for all available parameters.

```
$user = User::first();

$user->newOrder()
    ->setRecipientName('John Doe')
    ->setCountryCode('FR')
    ->create();
```

#### Adding images to orders

[](#adding-images-to-orders)

After creating an order you can add images to the order by calling the `addImage` method on your `Order` instance. The method requires an identification code of the product for this image and the image's URL. You can add multiple images to the order by chaining the `addImage` method.

```
$order = Order::first();

$order->addImage(
    'ART-PRI-HPG-20X28-PRODIGI_GB',
    'https://testserver.com/aphoto.jpg'
);
```

#### Submitting an order

[](#submitting-an-order)

When you are ready you can submit your order to Pwinty for processing. The validity of the order will first be checked and then submitted. If the order is not ready to be submitted an `OrderUpdateFailure` exception will be thrown. You can check if an order is submitted by calling the `submitted` method on your `Order` instance.

```
$order = Order::first();

$order->submit();

$order->fresh()->submitted(); // true
```

#### Cancelling an order

[](#cancelling-an-order)

You can cancel an open order at any given time by calling the `cancel` method on your `Order` instance. If the order status is not cancellable an `OrderUpdateFailure` exception will be thrown. You can check if an order is cancelled by calling the `cancelled` method.

```
$order = Order::first();

$order->cancel();

$order->fresh()->cancelled(); // true
```

#### Updating an order

[](#updating-an-order)

You can update any attribute of an open order by calling the `updatePwintyOrder` on your `Order` instance. If the order status is not updatable an `OrderUpdateFailure` exception will be thrown. The method will return you the raw Pwinty order object.

```
$order = Order::first();

$pwintyOrder = $order->updatePwintyOrder(['recipientName' => 'John Doe']);
```

#### Getting the raw Pwinty order

[](#getting-the-raw-pwinty-order)

You can get the raw Pwinty order object by calling the `asPwintyOrder` method on your `Order` instance. Check the [Pwinty documentation](https://pwinty.com/api/) for an example response.

```
$order = Order::first();

$pwintyOrder = $order->asPwintyOrder();
```

### Processing Pwinty Webhooks

[](#processing-pwinty-webhooks)

Pwinty can make callbacks to a custom URL whenever the status of one of your orders changes. By default, a route that points to a webhook controller is configured through the Pwinty service provider. All incoming Pwinty webhook requests will be handled there. Make sure that you have set up your callback URL under the integrations section of the Pwinty dashboard. The webhook controller listens to the `pwinty/webhook` URL path.

#### Signed Webhook URL

[](#signed-webhook-url)

To secure your webhooks you must add a signed URL to Pwinty dashboard. For convenience the package contains a console command that will generate a secure URL for you. Copy the signed URL and add it to Pwinty dashboard. A middleware is in place to validate the signed route requests.

```
php artisan pwinty:sign
```

#### CSRF Protection

[](#csrf-protection)

You gonna need to list the URI as an exception to the `VerifyCsrfToken` middleware included in your application.

```
class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        'pwinty/*'
    ];
}
```

#### Events

[](#events)

The package emits a `Wingly\Pwinty\Events\WebhookProcessed` event when a webhook was processed. The event contains the full payload of the Pwinty webhook. You can listen to this event if your application requires to take any actions when a webhook is received.

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [contributing.md](contributing.md) for details.

Credits
-------

[](#credits)

- [Dimitris Karapanos](https://github.com/gpanos)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see the [license file](license.md) for more information.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~101 days

Total

4

Last Release

1817d ago

PHP version history (3 changes)v1.0.0PHP ^7.2

v1.1.1PHP ^7.4

1.2.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12728267?v=4)[Dimitris Karapanos](/maintainers/gpanos)[@gpanos](https://github.com/gpanos)

---

Top Contributors

[![gpanos](https://avatars.githubusercontent.com/u/12728267?v=4)](https://github.com/gpanos "gpanos (24 commits)")

---

Tags

laravelpwintywingly

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wingly-pwinty/health.svg)

```
[![Health](https://phpackages.com/badges/wingly-pwinty/health.svg)](https://phpackages.com/packages/wingly-pwinty)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M165](/packages/spatie-laravel-health)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M130](/packages/roots-acorn)[flat3/lodata

OData v4.01 Producer for Laravel

99351.7k](/packages/flat3-lodata)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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