PHP code example of roots / support

1. Go to this page and download the library: Download roots/support library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

roots / support example snippets




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...
    }
);