PHPackages                             gentor/mautic-api-laravel - 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. gentor/mautic-api-laravel

ActiveLibrary[API Development](/categories/api)

gentor/mautic-api-laravel
=========================

Wrapper on the Mautic API for Laravel 4/5.x

610.4k4[2 issues](https://github.com/gentor/mautic-api-laravel/issues)PHP

Since Nov 11Pushed 3y ago2 watchersCompare

[ Source](https://github.com/gentor/mautic-api-laravel)[ Packagist](https://packagist.org/packages/gentor/mautic-api-laravel)[ RSS](/packages/gentor-mautic-api-laravel/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Mautic API
==========

[](#mautic-api)

Wrapper on the Mautic API for Laravel 4/5.x

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

[](#installation)

Installation using composer:

```
composer require gentor/mautic-api-laravel

```

Add the service provider in `config/app.php`:

```
Gentor\Mautic\MauticServiceProvider::class,
```

Add the facade alias in `config/app.php`:

```
Gentor\Mautic\Facades\Mautic::class,
```

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

[](#configuration)

Change your default settings in `app/config/mautic.php`:

```
return [
    'baseUrl' => env('MAUTIC_API_URL'),
    'userName' => env('MAUTIC_API_USERNAME'),
    'password' => env('MAUTIC_API_PASSWORD'),
];
```

Usage
-----

[](#usage)

- Creating an item

```
// Create contact
$fields = Mautic::contacts()->getFieldList();

$data = array();

foreach ($fields as $field) {
    $data[$field['alias']] = $_POST[$field['alias']];
}

// Set the IP address the contact originated from if it is different than that of the server making the request
$data['ipAddress'] = $ipAddress;

// Create the contact
$response = Mautic::contacts()->create($data);
$contact = $response[Mautic::contacts()->itemName()];
```

```
// Create company
$fields = Mautic::companies()->getFieldList();

$data = array();

foreach ($fields as $field) {
    $data[$field['alias']] = $_POST[$field['alias']];
}

// Create the company
$response = Mautic::companies()->create($data);
$contact = $response[Mautic::companies()->itemName()];
```

```
// Create contact with companies
$contact = Mautic::contacts()->createWithCompanies([
    'firstname' => 'Mautic',
    'lasttname' => 'Contact',
    'email' => 'contact@email.com',
    'companies' => [
        [
            'companyname' => 'Company 1',
        ],
        [
            'companyname' => 'Company 2',
        ],
    ],
]);
```

- Edit an item

```
$updatedData = array(
    'firstname' => 'Updated Name'
);

$response = Mautic::contacts()->edit($contactId, $updatedData);
$contact = $response[Mautic::contacts()->itemName()];

// If you want to create a new contact in the case that $contactId no longer exists
// $response will be populated with the new contact item
$response = Mautic::contacts()->edit($contactId, $updatedData, true);
$contact = $response[Mautic::contacts()->itemName()];
```

- Delete an item

```
$response = Mautic::contacts()->delete($contactId);
$contact = $response[Mautic::contacts()->itemName()];
```

- Error handling

```
// $response returned by an API call should be checked for errors
$response = Mautic::contacts()->delete($contactId);

if (isset($response['error'])) {
    echo $response['error']['code'] . ": " . $response['error']['message'];
} else {
    // do whatever with the info
}
```

Documentation
-------------

[](#documentation)

[Mautic API Library](https://github.com/mautic/api-library)

[Mautic API Docs](https://developer.mautic.org/#rest-api)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/210fd495e96c05caab1d50c09165794ff73175a9b49c43f91df0c8524dfa8add?d=identicon)[gentor](/maintainers/gentor)

---

Top Contributors

[![gentor](https://avatars.githubusercontent.com/u/2902504?v=4)](https://github.com/gentor "gentor (11 commits)")

### Embed Badge

![Health badge](/badges/gentor-mautic-api-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/gentor-mautic-api-laravel/health.svg)](https://phpackages.com/packages/gentor-mautic-api-laravel)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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