vaersaagod/bunnymate

Keeping your bunny finely-tuned for a hoppy life, mate!

1.0.0 2024-04-06 18:17 UTC

This package is auto-updated.

Last update: 2024-05-06 18:51:43 UTC


README

Keeping your bunny finely-tuned for a hoppy life, mate!

Logo

Description

BunnyMate integrates BunnyCDN with Craft CMS.

Requirements

This plugin requires Craft CMS 4.0.0 or later.

Disclaimer

This is a private plugin, made for Værsågod and friends.

Migrating from vaersaagod/bunny

  1. ddev craft plugin/uninstall bunny && ddev composer remove vaersaagod/bunny
  2. ddev composer require vaersaagod/bunnymate && ddev craft plugin/install _bunnymate
  3. Rename config/bunny.php to config/_bunnymate.php

Configuration

<?php

return [
    'pullingEnabled' => true,
    'pullZones' => [
        'default' => [
            'hostname' => 'https://awesome-project.b-cdn.net',
            'enabled' => true,
        ],
    ],
    'defaultPullZone' => 'default',
];

Usage

BunnyMate provides a global Twig function bunnyPullUrl(), which can be used to generate a Bunny CDN pullzone URL:

{% set bunnyUrl = bunnyPullUrl(asset) %}
{% set bunnyUrl = bunnyPullUrl(siteUrl('lorem/ipsim') %}
{% set bunnyUrl = bunnyPullUrl('lorem/ipsum') %}
{% set bunnyUrl = bunnyPullUrl('/lorem/ipsum', 'anotherZone') %}