New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

mralston/iq

Package for working with IQ CRM.
1,080
Install
composer require mralston/iq
Latest Version:v1.1.0
Laravel:7 – 13
License:MIT
Last Updated:Nov 9, 2026
Links: GitHub  ·  Packagist
Maintainer: mralston

IQ Solar

Introduction

This package provides a way to work with the IQ Solar database.

Config

This package uses the iq database connection. Add the following to config/database.php:

'iq' => [
    'driver' => 'sqlsrv',
    'url' => env('IQ_DATABASE_URL'),
    'host' => env('IQ_DB_HOST'),
    'port' => env('IQ_DB_PORT', 1433),
    'database' => env('IQ_DB_DATABASE'),
    'username' => env('IQ_DB_USERNAME'),
    'password' => env('IQ_DB_PASSWORD'),
    'charset' => 'utf8',
    'prefix' => '',
    'prefix_indexes' => true,
],

The database connection can then be set up as follows in the .env file:

IQ_DB_HOST=<IQ SQL Server hostname or IP address>
IQ_DB_DATABASE=<IQ SQL Server database>
IQ_DB_USERNAME=<IQ SQL Server username>
IQ_DB_PASSWORD=<IQ SQL Server password>

Timezone

IQ stores local wall-clock times. Every date the package stamps on a new customer (initial date, visit, invoice, install note, process action due dates and the notes heading) is taken in iq.timezone. Leave it null to use the application's timezone; set it when the application runs in UTC but IQ expects UK time:

IQ_TIMEZONE=Europe/London

Nova

A customer sold from a Nova quote is linked to it by tCustomers.NovaQuoteUuid (nvarchar(36)), which must be added to IQ before it is used:

$customer = Customer::withCompany($company)
    ->withRep($rep)
    // ...the other with* builders
    ->withNovaQuoteUuid($quote->uuid)
    ->withAttrs([...])
    ->create();

$customer = \Mralston\Iq\Models\Customer::findByNovaQuoteUuid($quote->uuid);
  • Without withNovaQuoteUuid() the column is never written, so IQ databases without it keep working.
  • With it, model_id may be left out: the customer's ImportId and QuoteId stay null and the tQuotes row is written with QuoteId 0. Without it, a missing model_id still throws NoQuoteException.
  • create() writes everything in one transaction on the iq connection and takes the order and invoice numbers from tUs under an update lock, so it is safe to run from queued jobs at once.
  • The service clears its builder state after every create(), and the facade resolves a fresh service for each call, so nothing set for one customer reaches the next.
  • It runs under Model::shouldBeStrict(). To pass the rep's branch, eager load it ($rep->load('branch')) rather than reading $rep->branch lazily.

Testing

composer install
composer test

The suite runs against in-memory SQLite registered as the iq connection.

Security Vulnerabilities

Please e-mail security vulnerabilities directly to me.

Licence

Package is open-sourced software licenced under the MIT license.

IQ Solar is produced by and remains copyright of Lewis John Limited.

Related Packages

mralston/lockout

Locks user accounts after a set number of failed login attempts.

1,087 1
mralston/mug

Library for working with My Utility Genius API.

1,085 0
mralston/pdf

Laravel wrapper for generating PDF files using headless Chrome/Chromium

1,002 6
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

665,354,487 9,703
laravel/framework

The Laravel Framework.

633,434,998 35,124

Version History

Version Released Laravel License
v1.1.0 ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v1.0.19 ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v1.0.18 ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v1.0.17 ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0 MIT
v1.0.16 ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0 MIT