Looking to hire Laravel developers? Try LaraJobs

laravel-zapier maintained by jeffersongoncalves

Description
Zapier integration for Laravel: manage Zaps, tasks, profile and trigger Zapier webhooks.
Last update
2026/09/08 03:19 (dev-main)
License
Downloads
6

Comments
comments powered by Disqus

Laravel Zapier

Laravel Zapier

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

Zapier integration for Laravel. Push payloads to Zapier catch hooks and drive the Zapier REST API — list Zaps, turn them on or off, read task history and the account profile — through a single facade.

Features

  • 🪝 Send data to Zapier catch hooks by URL or by a name declared in config
  • ⚡ Manage Zaps: list, inspect, turn on, turn off
  • 📜 Read the task history of a Zap
  • 👤 Read the authenticated Zapier profile
  • 🧪 Built on Laravel's HTTP client, so Http::fake() works in your tests

Installation

You can install the package via composer:

composer require jeffersongoncalves/laravel-zapier

Optionally publish the config file:

php artisan vendor:publish --tag=laravel-zapier-config

Add your credentials to .env:

ZAPIER_API_KEY=your-zapier-api-key

The API key is only needed for the REST API calls. Sending data to a catch hook works without it.

Usage

Sending data to a catch hook

Create a "Webhooks by Zapier → Catch Hook" trigger in Zapier and send it anything:

use JeffersonGoncalves\Zapier\Facades\Zapier;

Zapier::send('https://hooks.zapier.com/hooks/catch/123456/abcdef', [
    'name' => 'Ada Lovelace',
    'email' => 'ada@example.com',
]);

Prefer naming your hooks in config/zapier.php so URLs stay out of your code:

// config/zapier.php
'hooks' => [
    'new-lead' => env('ZAPIER_HOOK_NEW_LEAD'),
],
Zapier::send('new-lead', ['email' => 'ada@example.com']);

Fire and forget from a queue when the request should not block a web response:

dispatch(fn () => Zapier::send('new-lead', ['email' => $user->email]));

Managing Zaps

Zapier::zaps();              // list every Zap
Zapier::zap('123456');       // a single Zap
Zapier::enableZap('123456'); // turn it on
Zapier::disableZap('123456');// turn it off
Zapier::tasks('123456');     // task history for a Zap
Zapier::profile();           // the authenticated account

Dependency injection

The facade is optional — the client is registered as a singleton:

use JeffersonGoncalves\Zapier\Zapier;

public function __construct(protected Zapier $zapier) {}

Testing your own code

Because the package uses Laravel's HTTP client, fake it as usual:

use Illuminate\Support\Facades\Http;

Http::fake(['hooks.zapier.com/*' => Http::response(['status' => 'success'])]);

Configuration

Key Env Default Description
api_key ZAPIER_API_KEY null Zapier personal API key, required for REST API calls
base_url ZAPIER_BASE_URL https://api.zapier.com/v1 Zapier REST API base URL
timeout ZAPIER_TIMEOUT 10 HTTP timeout in seconds
hooks [] Named catch hook URLs

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email the author instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.