Installation and setup | laravel-slack-alerts-rust | Spatie       

 SPATIE  

laravel-slack-alerts-rust
=========================

spatie.be/open-source

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

 Version   v1      

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

  Installation and setup    
- [ Introduction ](https://spatie.be/docs/laravel-slack-alerts-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-slack-alerts-rust/v1/support-us)
- [ Installation and setup ](https://spatie.be/docs/laravel-slack-alerts-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-slack-alerts-rust/v1/usage)
- [ Testing ](https://spatie.be/docs/laravel-slack-alerts-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/laravel-slack-alerts-rust/v1/changelog)
- [ Releasing ](https://spatie.be/docs/laravel-slack-alerts-rust/v1/releasing)

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

You can install the package via Cargo:

```
cargo add spatie-laravel-slack-alerts
```

Requires Rust 1.99+, Laravel Rust `>=0.1.0, <1.0` and Laravel Package Tools `>=0.1.5, <1.0`.

Register the provider in your application's `src/app.rs`:

```
use laravel::Application;
use spatie_slack_alerts::service_provider;

Application::configure()
    .with_providers(|providers| {
        providers.add(service_provider());
    });
```

You can set a `SLACK_ALERT_WEBHOOK` env variable containing a valid Slack webhook URL. You can learn how to get a webhook URL [in the Slack API docs](https://api.slack.com/messaging/webhooks).

```
SLACK_ALERT_WEBHOOK=https://hooks.slack.com/services/your/webhook/url
SLACK_ALERT_ENABLED=true
SLACK_ALERT_QUEUE=default
```

Alternatively, customize the package's typed configuration in `with_config`. The provider registers defaults before application configuration and resolves `SlackAlert` lazily from the final settings:

```
use spatie_slack_alerts::{Config, service_provider};

let app = Application::configure()
    .with_providers(|providers| { providers.add(service_provider()); })
    .with_config(|config, _| {
        let slack = config.section_mut::<Config>();
        slack.webhook_urls.insert("default".into(), "https://example.com/default".into());
        slack.webhook_urls.insert("marketing".into(), "https://example.com/marketing".into());
        slack.queue = "notifications".into();
    })
    .create();
```

`Config` has four public settings: `enabled` (true by default), `webhook_urls` (the default URL comes from the environment), `queue` (`default`), and `job` (the callback that dispatches `SendToSlackChannelJob`). The [usage guide](usage#customizing-the-job) shows how to replace the job. Malformed boolean environment settings stop startup instead of silently enabling alerts.

Missing or empty webhook settings skip delivery. Invalid configured URLs return `Error::InvalidWebhook`. Only HTTP and HTTPS URLs with a host are accepted. Webhook URLs contain credentials; do not put real ones in source control. The configuration, alert and job Debug implementations redact webhook values.

The package does not require a database driver, Inertia, a view engine, migrations, or an installation command. For queued production delivery, configure a normal Laravel [queue connection and worker](https://laravel.com/rust/docs/queues). If you choose the database connection, enable the application's database driver and create Laravel's queue tables there. Tests use Laravel's synchronous queue fallback.

 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)
