Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Support Laravel Package

roots/support

General-purpose helper functions used across Roots WordPress projects. Includes Laravel-style env() lookup, value() for closures, utilities to add/remove callbacks across multiple WordPress actions/filters, and a wp_die() wrapper with Roots defaults.

View on GitHub
Deep Wiki
Context7

Support

General-purpose helper functions used across Roots WordPress projects.

Support us

Roots is an independent open source org, supported only by developers like you. Your sponsorship funds WP Packages and the entire Roots ecosystem, and keeps them independent. Support us by purchasing Radicle or sponsoring us on GitHub — sponsors get access to our private Discord.

Requirements

  • PHP 5.6+

Installation

composer require roots/support

Helpers

This package autoloads helpers.php and provides:

  • Roots\env($key, $default = null)
    Laravel-compatible environment lookup.
    Deprecated when \Illuminate\Support\Env is available (it delegates there automatically).
  • Roots\value($value)
    Returns $value() if the value is a closure, otherwise returns the value unchanged.
  • Roots\add_filters(iterable $filters, $callback, $priority = 10, $args = 2)
    Registers one callback across many filter hooks.
  • Roots\remove_filters(iterable $filters, $callback, $priority = 10)
    Removes one callback across many filter hooks.
  • Roots\add_actions(iterable $actions, $callback, $priority = 10, $args = 2)
    Alias of add_filters.
  • Roots\remove_actions(iterable $actions, $callback, $priority = 10)
    Alias of remove_filters.
  • Roots\wp_die($message, $subtitle = '', $title = '', $footer = '')
    Wrapper around WordPress wp_die() with Roots-flavored defaults.

Usage

<?php

use function Roots\add_actions;
use function Roots\env;

$apiKey = env('API_KEY', '');

add_actions(
    ['init', 'wp_loaded'],
    function () use ($apiKey) {
        if (! $apiKey) {
            return;
        }

        // Do work...
    }
);

Community

Keep track of development and community news.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor