PHPackages                             tbleckert/laramill - 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. tbleckert/laramill

ActiveLibrary[Payment Processing](/categories/payments)

tbleckert/laramill
==================

LaraMill is a Laravel package that provides a powerful bridge to Paymill that makes it easy to handle payments and subscriptions

v1.0-beta.2(11y ago)117[3 issues](https://github.com/tbleckert/laramill/issues)PHPPHP &gt;=5.4.0

Since Sep 24Pushed 11y ago1 watchersCompare

[ Source](https://github.com/tbleckert/laramill)[ Packagist](https://packagist.org/packages/tbleckert/laramill)[ RSS](/packages/tbleckert-laramill/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

LaraMill (former Billing)
=========================

[](#laramill-former-billing)

**Note**: Special thanks to @hostianer for the new name!

LaraMill is a Laravel package that provides a powerful bridge to Paymill that makes it easy to handle payments and subscriptions

- [Install](#install)
- [Configuration](#configure)
- [Offers](#offers)
- [Clients](#clients)
- [Payments](#payments)
- [Subscriptions](#subscriptions)
- [Transactions](#transactions)

Install
-------

[](#install)

Simply add LaraMill to your `composer.json`:

```
"tbleckert/laramill": "1.0-beta.2"

```

...and run `composer install tbleckert/laramill`. This will install the package. You also have to add `'Tbleckert\LaraMill\LaraMillServiceProvider'` to your providers array.

### Update users table

[](#update-users-table)

LaraMill saves and uses two database columns, these are: subscription\_id (string/varchar) and client\_id (string/varchar). This means you have to manually make a migration that adds these columns to your user table.

### Setup model

[](#setup-model)

To use LaraMill you have to update your User model to something like this:

```
use Tbleckert\LaraMill\LaraMillInterface;
use Tbleckert\LaraMill\LaraMillTrait;

class User extends Eloquent implements LaraMillInterface {

    use LaraMillTrait;

}

```

Configure
---------

[](#configure)

To start using LaraMill you need to publish the config files:

```
php artisan config:publish tbleckert/laramill

```

Then fill in your public and private Paymill keys in your new config located at `app/config/packages/tbleckert/laramill/config.php`

### Offers

[](#offers)

To add Paymill offers/plans you open the config file (see above) and fill the offers array as follows:

```
'offers'  => array(
	'Basic' => array(
		'monthly'  => 'offer_key',
		'annually' => 'offer_key'
	),
	'Special' => array(
		'daily'  => 'offer_key',
		'weekly' => 'offer_key'
	)
)

```

Each offer has a name and an array containing offer keys for each payment interval that the offer supports. As an example, you would use this code to subscribe a user to the basic plan with annual payment:

```
$user = User::find(1);
$user->subscription('Basic', 'annually')->create($token);

```

More about subscriptions further down.

Clients
-------

[](#clients)

Each user needs a client in Paymill. I suggest that you set up a client in the user registration step (even if you support free accounts). This way, you have the user prepared for subscriptions and payments.

### Create client

[](#create-client)

The `email` column will be used by default as the client email.

```
$user->client()->create();

```

To set a different email, you can just pass it as a parameter in the `create` method:

```
$user->client()->create('myemail@domain.com');

```

You can also add an optional description text

```
$user->client()->create('myemail@domain.com', 'Client description');

```

### Update client

[](#update-client)

Updating a client is very similar to creating one:

```
$user->client()->update('myemail@domain.com', 'Client description');

```

### Remove client

[](#remove-client)

To remove a client from paymill, simply use the `remove` method:

```
$user->client()->remove();

```

Payments
--------

[](#payments)

For any subscription or transaction, the client needs a payment. To create a payment we need to use the Paymill Bridge. The Bridge generates a token that we need when creating our payment.

### Create payment

[](#create-payment)

For the token generation, please have a look at the [official Paymill documentation](https://www.paymill.com/en-gb/documentation-3/introduction/payment-form/). Then, for the back-end:

```
$token = Input::get('paymillToken');
$user->payment($token)->create();

```

### Update payment

[](#update-payment)

There's no functionality for updating a payment, since that makes no sense. Instead, just create a new one and if you want, remove the old one.

### Remove payment

[](#remove-payment)

```
$user->payment(false, 'payment_id')->remove();

```

### Payment details

[](#payment-details)

The details for a payment can give you information like card type, last four card numbers and more.

```
$user->payment(false, 'payment_id')->details();

```

### List all payments

[](#list-all-payments)

To get all payments created for a user, use the `all` method:

```
$user->payment()->all();

```

Subscriptions
-------------

[](#subscriptions)

Subscriptions connects a client to an offer with a payment. Paymill handles the payments automatically on the given interval.

### Create subscription

[](#create-subscription)

For a subscription to work, the client needs a payment. You can either pass a payment id to the subscription method or let LaraMill automatically set the last registered payment. If the user already have a subscription, the create method will throw an exception.

```
$user->subscription('Basic', 'annually')->create(); // Alternative 1
$user->subscription('Basic', 'annually', 'payment_id')->create(); // Alternative 2

```

### Subscription details

[](#subscription-details)

Since the subscription id is saved to the database, you don't have to pass any parameter.

```
$user->subscription()->details();

```

### Swap subscription

[](#swap-subscription)

To move the client to a new subscription plan you can use the swap method. Set the new subscription (just like the create method) and call `swap`.

```
$user->subscription('Basic', 'monthly')->swap();

```

### Pause subscription

[](#pause-subscription)

Pausing a subscription requires no parameters and you can use `resume` to resume the subscription at any time.

```
$user->subscription()->pause();

```

### Resume subscription

[](#resume-subscription)

When a subscription is paused you can use this method to activate it again.

```
$user->subscription()->resume();

```

### Remove subscription

[](#remove-subscription)

Removing a subscription will delete it completely from Paymill and removes the subscription id from the database. Check the `cancel` method to only cancel the subscription.

```
$user->subscription()->remove();

```

### Cancel subscription

[](#cancel-subscription)

When you cancel a subscription it will remain in your database and in Paymill, but it will not be active. Therefor it can be activated again manually in the Paymill admin. To completely remove it, see the `remove` method.

```
$user->subscription()->cancel();

```

### List all subscriptions

[](#list-all-subscriptions)

At the moment, LaraMill only supports 1 subscription per user, but the `all` method still exists:

```
$user->subscription()->all();

```

Transactions
------------

[](#transactions)

Transactions are one off payments and can be made against a stored payment.

### Create transaction

[](#create-transaction)

For a transaction to work, the client needs a payment. You can either pass a payment id to the transaction method or let LaraMill automatically set the last registered payment.

```
$transaction = $user->transaction('payment_id', false, 1000)->create();

```

### Transaction details

[](#transaction-details)

The details for a transaction can give you information like card type, last four card numbers and more.

```
$transaction = $user->transaction(false, 'transaction_id')->details();

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Total

2

Last Release

4049d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/263465?v=4)[Tobias Bleckert](/maintainers/tbleckert)[@tbleckert](https://github.com/tbleckert)

---

Top Contributors

[![tbleckert](https://avatars.githubusercontent.com/u/263465?v=4)](https://github.com/tbleckert "tbleckert (43 commits)")

---

Tags

laravelbillingpaymentspaymill

### Embed Badge

![Health badge](/badges/tbleckert-laramill/health.svg)

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

###  Alternatives

[threesquared/laravel-paymill

Laravel wrapper for the Paymill API

121.3k](/packages/threesquared-laravel-paymill)[mmanos/laravel-billing

A billing package for Laravel 4.

451.3k](/packages/mmanos-laravel-billing)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[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)
