isap-ou/laravel-agile-crm

This package is abandoned and no longer maintained. The author suggests using the isapp/laravel-agile-crm package instead.

Laravel HTTP Client for AgileCRM

1.1.2 2025-01-06 11:18 UTC

This package is auto-updated.

Last update: 2025-01-06 11:19:26 UTC


README

AgileCRM Client for Laravel Latest Version on Packagist Total Downloads

Please note!

We only include the endpoints necessary for the team's projects. If any endpoints are missing, feel free to create a pull request (PR) to add the required endpoints.

Installation

You can install the package via composer:

composer require isapp/laravel-agile-crm

You will most likely need to edit the extensive configuration, so you can publish the config file with:

php artisan vendor:publish --tag="agile-crm"

Usage

This package is based on documentation of Agile CRM REST API

Each AgileCRM entity is implemented as a lightweight DTO (Data Transfer Object), providing straightforward access to the underlying data. This design minimizes the need for redundant validation processes and ensures that data handling remains simple and efficient without adding unnecessary complexity.

Configuration

First You need to add environment variables Authentication credentials:

AGILE_CRM_DOMAIN=domain
AGILE_CRM_EMAIL=example@mail.com
AGILE_CRM_API_KEY=855*********************88

To work with multiple domains in parallel, simply add a new domain to the config/agile-crm.php file.

return [
    ...

    'domains' => [
       ...
       'custom_domain' => [
           'domain' => env('AGILE_CRM_DOMAIN'),
           'email' => env('AGILE_CRM_EMAIL'),
           'api_key' => env('AGILE_CRM_API_KEY'),
       ],
    ],
];

Examples:

Make request for default domain

$contact = AgileCrm::contacts()->index()

Make request for NON default domain

$contact = AgileCrm::domain('custom_domain')->contacts()->index()

Get contacts list

$contact = AgileCrm::contacts()->index()

Result will Collection of ContactDto

Create contact

use Isapp\AgileCrm\Dto\ContactDto;
use Isapp\AgileCrm\Dto\ContactPropertyDto;
use Isapp\AgileCrm\Enums\ContactSystemPropertyName;
 
...
 
$properties = [];
$properties[] = new ContactPropertyDto(
    name: ContactSystemPropertyName::FIRST_NAME,
    value: 'John',
);
$properties[] = new ContactPropertyDto(
    name: ContactSystemPropertyName::LAST_NAME,
    value: 'Doe',
);
$properties[] = new ContactPropertyDto(
    name: ContactSystemPropertyName::EMAIL,
    value: 'mail@example.com',
);
$dto = new ContactDto(properties: $properties);

$contactDto = AgileCrm::contacts()->create($dto);

...

Result will ContactDto

Contributing

Contributions are welcome! If you have suggestions for improvements, new features, or find any issues, feel free to submit a pull request or open an issue in this repository.

Thank you for helping make this package better for the community!

License

This project is open-sourced software licensed under the MIT License.

You are free to use, modify, and distribute it in your projects, as long as you comply with the terms of the license.

Maintained by ISAPP and ISAP OÜ.
Check out our software development services at isap.me.