PHPackages                             sustainable-hustle/astrel-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sustainable-hustle/astrel-laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sustainable-hustle/astrel-laravel
=================================

Integrate Astrel to your Laravel applications.

v1.0.2(4y ago)3736MITPHPPHP ^7.4|^8.0

Since Sep 13Pushed 4y ago3 watchersCompare

[ Source](https://github.com/sustainable-hustle/astrel-laravel)[ Packagist](https://packagist.org/packages/sustainable-hustle/astrel-laravel)[ Docs](https://github.com/sustainable-hustle/astrel-laravel)[ RSS](/packages/sustainable-hustle-astrel-laravel/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

✨ Astrel Laravel
================

[](#-astrel-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3bd803de03c44bb85c076b36f2b76de26e90344743c98b98b10e80d927136b43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7375737461696e61626c652d687573746c652f61737472656c2d6c61726176656c2e737667)](https://packagist.org/packages/sustainable-hustle/astrel-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/21524769ffb8220ae1b3729a03e20cabdeb1e2a8cebc3c3d2e6c90aca4e9e743/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7375737461696e61626c652d687573746c652f61737472656c2d6c61726176656c2f54657374733f6c6162656c3d7465737473)](https://github.com/sustainable-hustle/astrel-laravel/actions?query=workflow%3ATests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/07c6e160effa23e6b4d5ee7ce0f6527050d1e3303292aaed8f3f42d51403c609/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7375737461696e61626c652d687573746c652f61737472656c2d6c61726176656c2e737667)](https://packagist.org/packages/sustainable-hustle/astrel-laravel)

Integrate [Astrel](https://astrel.io) to your Laravel applications.

[Astrel](https://astrel.io) is a remote config orchestration application that enables you to change anything in your apps without touching your code.

🍿 **Are you a visual learner?** [Here a quick video tutorial](https://youtu.be/p6s5ddh8hZI) to help you get started with Astrel and Laravel.

Installation
------------

[](#installation)

Install this package via composer.

```
composer require sustainable-hustle/astrel-laravel
```

Add your Astrel API key in your `.env` file.

```
ASTREL_API_KEY="sxjTgBJAxkT2TNyKf9vabFI0L07AyItM5o3iiloS"
```

Finally, [listen for Astrel's webhooks](#clear-the-cache-when-receiving-a-webhook) to clear the cache.

```
// routes/web.php
use SustainableHustle\Astrel\Facades\Astrel;
Astrel::webhookRoute('astrel/webhook');

// Make sure CSRF verification is disabled on that route.
class VerifyCsrfToken extends Middleware
{
    protected $except = [
        '/astrel/webhook',
    ];
}
```

Optionally, publish the `astrel` config file.

```
php artisan vendor:publish --tag="astrel-config"
```

Basic usage
-----------

[](#basic-usage)

This package provides a facade you can use to retrieve one or many aspects. An aspect is a key/value pair that you configure and updates directly on your Astrel dashboard.

```
use SustainableHustle\Astrel\Facades\Astrel;

Astrel::all();                        // Returns all aspects.
Astrel::get('slug');                  // Returns the value of an aspect by giving its slug.
Astrel::get('slug', 'default value'); // Returns the default value if the given aspect has no value.
```

Alternatively, you may use the `astrel` helper method to access the Astrel manager or to access a value directly.

```
astrel()->all();                 // Equivalent to Astrel::all();
astrel('slug');                  // Equivalent to Astrel::get('slug');
astrel('slug', 'default value'); // Equivalent to Astrel::get('slug', 'default value');
```

Note that if you'd like to fallback to an environment variable you may also use the `astrel_env` helper function like so.

```
astrel_env('my-slug');                           // Equivalent to astrel('my-slug', env('MY_SLUG'));
astrel_env('my-slug', 'MY_ENV_SLUG');            // Equivalent to astrel('my-slug', env('MY_ENV_SLUG'));
astrel_env('my-slug', 'MY_ENV_SLUG', 'default'); // Equivalent to astrel('my-slug', env('MY_ENV_SLUG', 'default'));
```

Caching
-------

[](#caching)

This package automatically caches all retrieved aspects. This ensure your application does not make API calls every single time a value from Astrel is required.

You may use the `flush` and `refetch` methods from the `Astrel` facade to clear the cache as well as refetching its content immediately.

```
use SustainableHustle\Astrel\Facades\Astrel;

Astrel::flush()   // Flush the cache for all aspects.
Astrel::refetch() // Flush the cache and refetch all aspects immediately.
```

By default, the cache never expires meaning you will have to manually flush it when necessary. This is because Astrel will send you a webhook whenever something changes so you can flush the cache only when necessary (see section below).

However, if you'd like to customize the cache's lifetime, you may update the `cache_lifetime` variable in your `config/astrel.php` file.

Clear the cache when receiving a webhook
----------------------------------------

[](#clear-the-cache-when-receiving-a-webhook)

As mentioned above, you can configure Astrel to send you a webhook whenever any value gets updated. That means you can use this webhook to clear and immediately refetch all of your aspects.

This package provides a helper method `webhookRoute` on the `Astrel` facade that does just that. Simply add this to your routes file and chain any route configuration you might like.

```
use SustainableHustle\Astrel\Facades\Astrel;

Astrel::webhookRoute();                 // Register a route that calls `Astrel::refetch()` when triggered.
Astrel::webhookRoute('astrel/webhook'); // Provide a custom path to that route.
Astrel::webhookRoute('astrel/webhook')  // This method returns a Route object so you can chain anything you want.
    ->name('webhooks.astrel')
    ->middleware('web');
```

Additionally, if you're using the default `web` middleware group, make sure to disable CSRF verification for that route in the `VerifyCsrfToken` middleware.

```
class VerifyCsrfToken extends Middleware
{
    protected $except = [
-       //
+      '/astrel/webhook',
    ];
}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

4

Last Release

1695d ago

Major Versions

v0.1.0 → v1.0.02021-09-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/284b8d85b9924296c19360effa1758a9f534b12a6bc0235fd31ab70c6bc63318?d=identicon)[lorisleiva](/maintainers/lorisleiva)

![](https://www.gravatar.com/avatar/fbb854e09eb0aafbd7b8dc4517599ced8da6b8528c9d4ddfe82a4fc9691e8796?d=identicon)[slashequip](/maintainers/slashequip)

---

Top Contributors

[![lorisleiva](https://avatars.githubusercontent.com/u/3642397?v=4)](https://github.com/lorisleiva "lorisleiva (23 commits)")

---

Tags

configlaravellaravelremote configastrel

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/sustainable-hustle-astrel-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/sustainable-hustle-astrel-laravel/health.svg)](https://phpackages.com/packages/sustainable-hustle-astrel-laravel)
```

###  Alternatives

[maestroerror/laragent

Power of AI Agents in your Laravel project

630106.4k](/packages/maestroerror-laragent)[nativephp/mobile

NativePHP for Mobile

82724.0k43](/packages/nativephp-mobile)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[spatie/laravel-rdap

Perform RDAP queries in a Laravel app

72108.3k2](/packages/spatie-laravel-rdap)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
