Download the PHP package electriccitizen/citizen_edge without Composer

On this page you can find all versions of the php package electriccitizen/citizen_edge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package citizen_edge

Citizen Edge

A Drupal package for the media file lifecycle: editors can see where media is used, replace a file while keeping its URL, and delete a file so it actually disappears — including from the hosting platform's edge cache, which is what historically made replaced and deleted files "come back."

Acquia and Pantheon both cache files at the edge for about a year by default (max-age=31536000 on Acquia from core's .htaccess, max-age=31622400 on Pantheon), so without purging, a replaced or deleted file keeps serving at its old URL long after Drupal did the right thing.

Renamed from citizen_media_files (3.0.0)

Versions before 3.0.0 shipped as citizen_media_files (Composer package electriccitizen/citizen_media_files). Drupal treats the new name as a different module, so a site already running the old one migrates like this:

Uninstalling the old module strips its usage-count field from every view first (so no view is deleted by the config dependency cascade), and enabling the new one re-adds it under the new plugin id citizen_edge_usage_count. Settings keys moved from citizen_media_files_* to citizen_edge_*, the retry queue is citizen_edge_edge_purge, drush commands are ce:* (the old cmf:* aliases still work), and the replace media files permission keeps its name.

What it bundles

Requiring this one package pulls in and (on enable) installs:

Plus drush tooling (ce:setup, ce:purge, ce:edge-test) and a query-free Views field for a per-row usage count.

Requirements

Installing

Enable dependency patching once in the site's root composer.json so the contrib patch this module declares (see below) applies automatically:

Then read the citizen_edge log channel (or run drush ce:setup --dry-run beforehand). The setup adapts to the site and reports every decision — what it configured and what it deliberately left for a human.

What setup configures — and what it refuses to touch

The setup routine applies a baseline only into a vacuum. Existing site choices are never overwritten; each skipped piece is reported instead.

Re-running and previewing setup

hook_install() runs the setup once. The same routine is available any time, idempotently, as a drush command — for reviewing what a site will get before enabling, and for re-aligning a site after a media type or role is added:

Every decision prints as a table and, when applied, also logs to the citizen_edge channel.

Why the setup is code, not a Recipe

Drupal Recipes were evaluated for this. A recipe's config actions need concrete config names: core.entity_form_display.media.<type>.default requires knowing each site's media type IDs, and user.role.<id>: grantPermissions requires knowing which role is the manager. Those differ on every site this package targets, which is exactly the variability the adaptive setup exists to absorb. A recipe also cannot merge columns into an existing media view without custom code. The reviewability a recipe would offer is provided instead by ce:setup --dry-run, which prints the exact decisions for the site in front of you. If a fleet standardises on fixed media type and role names, a thin recipe wrapping this module becomes straightforward, and the setup routine is written so that can happen without changing the runtime.

Optional: standard enforcement (citizen_edge_standard)

The base module adapts and defers to existing config. Enabling citizen_edge_standard is the opt-in to a fixed standard, and it deliberately OVERRIDES existing configuration:

Settings

How purging works

Cloudflare layer (optional, chained)

Sites behind a Cloudflare zone you control have a third cache: Cloudflare caches files at its edge honoring the origin's cache-control. When configured, the module purges Cloudflare BY URL in addition to the host purge, on every replace and delete, with the same retry queue. The token needs only Zone > Cache Purge. Unconfigured sites skip this silently. Never configure it against a Cloudflare account that belongs to someone else.

Editor workflow (train content teams on this)

  1. Check usage before deleting: the media list's "Usage count" column or the Usage tab. Zero usage on the published version means safe.
  2. Replace: media edit form, "Replace file", keep the overwrite box checked, and the replacement file type must match the original.
  3. Delete: deleting the media entity deletes the file too (checkbox defaults on).
  4. Sensitive removals additionally need a Google Search Console removal request.

What the safety nets do not see

Two cases slip past both entity_usage and Media File Delete's file-usage guard, and editors should know it:

What purging cannot fix

Browser caches that already hold a file (served with a year-long max-age before this module was installed), search engine indexes (use a removal request for sensitive documents), and third-party archives. Consider shortening the file max-age in .htaccess alongside this module so browsers re-check files at a sane interval.

Drush commands

Known edge-layer limits

The module purges the HOSTING platform's edge (Acquia Varnish/Platform CDN, Pantheon Global CDN) and, optionally, a Cloudflare zone you control. Any other CDN stacked in front of the site is a separate cache this module cannot reach.

Required contrib patch: slow replace-saves (media_entity_file_replace)

media_entity_file_replace's submit handler calls image_path_flush() unconditionally — even when the replaced file is a document. Core's ImageStyle::flush() then stats a would-be derivative for EVERY image style on the site, and on network filesystems each stat is a slow remote call. Measured on one production site with 126 image styles: 7.96s for the flush alone, turning a ~1.1s document replace-save into ~9-10s.

Fix: filed upstream as #3619311 (skips the flush for non-image files; image replaces still flush, correctly). This module DECLARES the patch in its own composer.json by its public drupal.org URL, so Composer-consuming sites only need "enable-patching": true in the root composer.json (cweagans/composer-patches v1). The patch — and any future patch this module ships — then applies automatically when the module is installed or updated.

Sites that vendor the module by hand instead of consuming it via Composer never see the module's declaration and must wire the patch in their root composer.json themselves: copy patches/media_entity_file_replace-skip-flush-non-images.patch into the site's own patches/ directory and add a root extra.patches entry pointing at it. Do NOT reference the patch inside this module's install path from a site's root composer.json: on a fresh composer install the patched package can install before this module exists on disk, the patch file is missing at apply time, and composer-exit-on-patch-failure aborts the whole build.

If upstream merges #3619311 and cuts a release, drop the declaration and bump the constraint instead.

Image replaces on style-heavy NFS sites remain slower than document replaces — that cost is core's flush design. A site with 100+ image styles should audit them; it helps every save path, not just this module's.

Development

Kernel tests cover URL collection, deferral, dedupe, the new-upload skip, the inline limit, the retry queue, and every branch of the setup routines (fresh site, dry run, idempotency, respected site choices, the permission matrix with and without site_manager, the view merge). From a site root with drupal/core-dev installed:

Coding standards: phpcs --standard=Drupal,DrupalPractice clean.

Changes land in this repository first and reach sites through Composer. Site repositories should never carry local edits to the module.


All versions of citizen_edge with dependencies

PHP Build Version
Package Version
Requires drupal/entity_usage Version ^2.0@beta
drupal/media_entity_file_replace Version ^1.3
drupal/media_file_delete Version ^1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package electriccitizen/citizen_edge contains the following files

Loading the files please wait ...