PHP code example of electriccitizen / citizen_edge

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

    

electriccitizen / citizen_edge example snippets


// Force or disable host detection (default: AH_SITE_ENVIRONMENT => acquia,
// PANTHEON_ENVIRONMENT => pantheon, Cloudways filesystem layout => cloudways,
// otherwise none/log-only). Set 'none' on hosts that set a platform variable
// but where no purge stack can be installed.
$settings['citizen_edge_host'] = 'acquia'; // 'pantheon' | 'cloudways' | 'none'

// Public base URLs to purge. Varnish/CDN cache one object per scheme+host,
// so multi-domain sites must purge every public domain, and CLI-generated
// URLs (cron, drush) would otherwise purge http:// variants that miss the
// cached https:// object. Without this setting, the generated host is kept
// and the scheme is forced to https.
$settings['citizen_edge_base_urls'] = [
  'https://www.example.org',
  'https://exampleprod.prod.acquia-sites.com',
];

// Per-request cap on inline deferred purge URLs (default 500). A request
// that defers more than this (bulk delete, migration) hands everything to
// the cron retry queue instead of firing hundreds of API calls at terminate.
$settings['citizen_edge_inline_purge_limit'] = 500;

// Optional: override Acquia Platform CDN (Fastly) credentials. On Acquia,
// these are read automatically from the platform's own
// $settings['acquia_service_credentials']['platform_cdn'], so you normally
// set nothing. Provide them explicitly only for a Fastly service that is not
// delivered through Acquia's platform config, keeping the token out of
// committed code. See the Acquia Platform CDN section below.
$settings['citizen_edge_fastly'] = [
  'service_id' => '<fastly service id>',
  'token' => getenv('FASTLY_API_TOKEN'),
];

// Optional Cloudflare layer — see below.
$settings['citizen_edge_cloudflare'] = [
  'zone_id' => '<zone id>',
  'api_token' => getenv('CLOUDFLARE_API_TOKEN'),
];