PHP code example of automattic / jetpack-constants

1. Go to this page and download the library: Download automattic/jetpack-constants 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/ */

    

automattic / jetpack-constants example snippets


use Automattic\Jetpack\Constants;

$constant_value = Constants::get_constant( 'CONSTANT_NAME' );

use Automattic\Jetpack\Constants;

$value = 'some value';
Constants::set_constant( 'CONSTANT_NAME', $value );

use Automattic\Jetpack\Constants;

$defined = Constants::is_defined( 'CONSTANT_NAME' );

use Automattic\Jetpack\Constants;

$is_truthy = Constants::is_true( 'CONSTANT_NAME' );

use Automattic\Jetpack\Constants;

Constants::clear_single_constant( 'CONSTANT_NAME' );

use Automattic\Jetpack\Constants;

Constants::clear_constants();