Download the PHP package wazza/sync-model-to-crm without Composer

On this page you can find all versions of the php package wazza/sync-model-to-crm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sync-model-to-crm

GitHub issues GitHub stars GitHub license

Sync Model to CRM

Easily synchronize your Laravel Eloquent models with remote CRM providers such as HubSpot, Pipedrive, and more. This package allows you to define which model properties and relationships should be kept in sync with external CRM objects, providing a seamless integration experience.


Features


Supported CRMs


Requirements


How It Works

Define a set of properties on your Eloquent models to control how and when they sync with your CRM provider. After the first successful sync, the CRM object’s primary key is stored in a mapping table for efficient future updates.

Required Model Properties

Add the following properties to your model to enable CRM synchronization:

Property Type Description
$syncModelCrmEnvironment string/array/null CRM environments to sync with (e.g., ['sandbox', 'production']). Defaults to config value.
$syncModelCrmPropertyMapping array (required) Maps local model attributes to CRM fields.
$syncModelCrmUniqueSearch array (required) Defines unique fields for identifying CRM records.
$syncModelCrmRelatedObject string CRM object type (e.g., contact). Defaults to config mapping.
$syncModelCrmDeleteRules array (required) Rules for handling deletes (soft/hard) in the CRM.
$syncModelCrmActiveRules array (required) Rules for restoring/reactivating records in the CRM.
$syncModelCrmAssociateRules array (optional) Defines associations with other CRM objects.

Example: User Model

Below is a sample User model configured for CRM synchronization:


Usage

You can trigger a model sync in several ways:

  1. Using the ShouldSyncToCrmOnSave (Automatic Sync on Save): Add the ShouldSyncToCrmOnSave to your Eloquent model to automatically trigger a CRM sync every time the model is saved (created or updated). This is the easiest way to ensure your model stays in sync with your CRM provider without writing custom logic.

    When to use:

    • Use ShouldSyncToCrmOnSave if you want your model to always sync to the CRM automatically after every save (create/update), with no extra code required.
    • This is ideal for most use cases where you want seamless, automatic syncing.
  2. Using the HasCrmSync (Manual or Custom Sync): Add the HasCrmSync to your model if you want to control exactly when the sync happens. This trait provides methods like $this->syncToCrm(), $this->syncToCrmCreate(), $this->syncToCrmUpdate(), etc., which you can call from mutators, custom methods, or anywhere in your application.

    When to use:

    • Use HasCrmSync if you want to trigger syncs only at specific times, or if you need to customize the sync logic (e.g., only sync on certain conditions, or from a controller, observer, or job).
    • This is ideal for advanced use cases or when you want more granular control over syncing.
  3. Directly in a Controller:

    Note: Instantiating with new CrmSyncController() will always create a new instance, bypassing the singleton. To use the singleton, always resolve it from the container.

  4. Via an Observer: Register an observer to automatically sync after save, update, delete, or restore events.

  5. In a Job: Offload sync logic to a queued job for asynchronous processing.

Installation

  1. Install via Composer:

  2. Register the Service Provider (if not auto-discovered): Add to bootstrap/providers.php:

    If your package supports Laravel auto-discovery, this step may be optional.

  3. Publish Config and Migrations:

  4. Configure Environment Variables: Add the following to your .env file (see config/sync_modeltocrm.php for details):

  5. Cache Config:

  6. Review Configuration: Adjust the published config file as needed. You also do not need all of the env settings above, have a look at the config file and overwrite any applicable items. Happy coding 😉

Monitoring & Logs

Set your desired log level in the config file (1 = high, 3 = low verbosity). Monitor sync activity in your Laravel log file:


Testing

We have included a few unit tests, please expand if you wish to fork and help expand the functionalities.

Example output:

More tests and features coming soon!


License

This project is open-sourced under the MIT license.


All versions of sync-model-to-crm with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
guzzlehttp/guzzle Version ^7.8
hubspot/api-client Version ^10.2
illuminate/support Version ^12.0
php Version ^8.2 || ^8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wazza/sync-model-to-crm contains the following files

Loading the files please wait ....