Installation and setup | laravel-webhook-client-rust | Spatie       

 SPATIE  

  Laravel Webhook Client Rust 
==============================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-webhook-client-rust](https://spatie.be/docs/laravel-webhook-client-rust/v1)  Installation and setup

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-webhook-client-rust/v1) 

  Installation and setup    
- [ Introduction ](https://spatie.be/docs/laravel-webhook-client-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-webhook-client-rust/v1/support-us)
- [ Installation and setup ](https://spatie.be/docs/laravel-webhook-client-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-webhook-client-rust/v1/usage)
- [ Customizing the package ](https://spatie.be/docs/laravel-webhook-client-rust/v1/customizing-the-package)
- [ Storing attachments ](https://spatie.be/docs/laravel-webhook-client-rust/v1/attachments)
- [ Testing ](https://spatie.be/docs/laravel-webhook-client-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/laravel-webhook-client-rust/v1/changelog)

 Installation and setup
======================

###  On this page 

1. [ Configuring the package ](#content-configuring-the-package)
2. [ Preparing the database ](#content-preparing-the-database)
3. [ Taking care of routing ](#content-taking-care-of-routing)

Requires Rust 1.99 or newer and Laravel Rust 0.1.0. SQLite is enabled by default. For another database, disable default features and enable `database-postgres` or `database-mysql`. The framework requires at least one database driver.

```
cargo add spatie-laravel-webhook-client --features database-sqlite
```

Configuring the package
-----------------------------------------------------------------------------------------------------------------------------

The package uses `spatie-laravel-package-tools` from crates.io. Register its native service provider to add typed configuration, the database migration and package commands. Application configuration overrides package defaults.

```
use laravel::{Application, config::Env};
use spatie_laravel_webhook_client::{Config, service_provider};

let app = Application::configure()
    .replace_env(Env::default())
    .with_providers(|providers| { providers.add(service_provider()); })
    .with_config(|config, _| {
        config.set(Config { delete_after_days: Some(14), ..Config::default() });
    })
    .create();
```

Real applications can use their normal environment loading instead of `replace_env`. Load signing secrets from your environment or secret manager, not source control. Debug output redacts the signing secret.

Preparing the database
--------------------------------------------------------------------------------------------------------------------------

Run the application's `migrate` command after registering the provider. Registration never executes migrations. The migration creates `webhook_calls` with endpoint name, full URL, selected headers, payload, attachments, exception details, and timestamps. Configure a custom storage model if you need another table or extra columns.

Taking care of routing
--------------------------------------------------------------------------------------------------------------------------

Register a normal Laravel route whose handler calls `WebhookProcessor::process`. Use an API route, or explicitly exclude only the webhook endpoint from CSRF checks. A signature is not a CSRF token. Keep request-size limits enabled.

See [usage](usage) for the complete handler and queue job.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
