PHPackages                             c2h6/twill-croppa - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. c2h6/twill-croppa

ActiveLibrary[Image &amp; Media](/categories/media)

c2h6/twill-croppa
=================

Use Croppa as media rendering service in Twill applications

v3.0.0(4mo ago)1592↓100%MITPHPPHP ^8.3|^8.4

Since Mar 23Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/C2H6-383/twill-croppa)[ Packagist](https://packagist.org/packages/c2h6/twill-croppa)[ Docs](https://github.com/C2H6-383/twill-croppa)[ RSS](/packages/c2h6-twill-croppa/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

twill-croppa
============

[](#twill-croppa)

Use Croppa as media rendering service in Twill applications.

Learn more about Croppa at

Learn more about Twill CMS at

About this package
------------------

[](#about-this-package)

[![](https://camo.githubusercontent.com/03954d582e093b189b6c5e2a574b191376de2ac94b036eb25fd30578e0183cd5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f433248362d3338332f7477696c6c2d63726f707061)](https://camo.githubusercontent.com/03954d582e093b189b6c5e2a574b191376de2ac94b036eb25fd30578e0183cd5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f433248362d3338332f7477696c6c2d63726f707061)[![](https://camo.githubusercontent.com/7f5e9c2c77f6b684cd0f1349b5d5809bdb23134dc523c21c7f294aeb71a88ed5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265616c6573652f433248362d3338332f7477696c6c2d63726f7070612e737667)](https://camo.githubusercontent.com/7f5e9c2c77f6b684cd0f1349b5d5809bdb23134dc523c21c7f294aeb71a88ed5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265616c6573652f433248362d3338332f7477696c6c2d63726f7070612e737667)[![](https://camo.githubusercontent.com/76c3afc1041288df7a167f72f64fd78fb3b76732bb306d3b35d10d72adc24553/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f633268362d3338332f7477696c6c2d63726f707061)](https://camo.githubusercontent.com/76c3afc1041288df7a167f72f64fd78fb3b76732bb306d3b35d10d72adc24553/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f633268362d3338332f7477696c6c2d63726f707061)[![](https://camo.githubusercontent.com/ecf7acb24785f7de6dcc378bf9254cad091344edf0af4a373384b0eee7b37a86/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f433248362d3338332f7477696c6c2d63726f7070612f6c61746573742e737667)](https://camo.githubusercontent.com/ecf7acb24785f7de6dcc378bf9254cad091344edf0af4a373384b0eee7b37a86/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f433248362d3338332f7477696c6c2d63726f7070612f6c61746573742e737667)[![](https://camo.githubusercontent.com/88430ed590183f22a581106d44789c9df6fe26bbf2a2b1c8e54a3b4096cf06a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f433248362d3338332f7477696c6c2d63726f7070612e737667)](https://camo.githubusercontent.com/88430ed590183f22a581106d44789c9df6fe26bbf2a2b1c8e54a3b4096cf06a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f433248362d3338332f7477696c6c2d63726f7070612e737667)[![](https://camo.githubusercontent.com/cbfc63c654dc6a4e6dee050c692540c635e5db3047a2477211afa28a098384b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f433248362d3338332f7477696c6c2d63726f7070612e737667)](https://camo.githubusercontent.com/cbfc63c654dc6a4e6dee050c692540c635e5db3047a2477211afa28a098384b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f433248362d3338332f7477696c6c2d63726f7070612e737667)[![](https://camo.githubusercontent.com/217fb4a84c090bead533e93e7253a3074da3dba41d83870713db786f21a161bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f433248362d3338332f7477696c6c2d63726f7070612e737667)](https://camo.githubusercontent.com/217fb4a84c090bead533e93e7253a3074da3dba41d83870713db786f21a161bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f433248362d3338332f7477696c6c2d63726f7070612e737667)[![](https://camo.githubusercontent.com/a17b4f54c6d6803360724e423d72ad2d340b2bac3c2cbd94d682dea3f2f459ef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f433248362d3338332f7477696c6c2d63726f7070612e737667)](https://camo.githubusercontent.com/a17b4f54c6d6803360724e423d72ad2d340b2bac3c2cbd94d682dea3f2f459ef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f433248362d3338332f7477696c6c2d63726f7070612e737667)[![](https://camo.githubusercontent.com/0ba7919c2e28b0f7c6b72c1ea065035668094571c3a928b3eee16047dc0c2351/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f433248362d3338332f7477696c6c2d63726f7070612e737667)](https://camo.githubusercontent.com/0ba7919c2e28b0f7c6b72c1ea065035668094571c3a928b3eee16047dc0c2351/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f433248362d3338332f7477696c6c2d63726f7070612e737667)

[![](https://camo.githubusercontent.com/c9b9ddbd03b8ed3e638a656c94a0cefa17d01e715df773b1ee7167b91c9cab7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f633268362f7477696c6c2d63726f7070612e737667)](https://camo.githubusercontent.com/c9b9ddbd03b8ed3e638a656c94a0cefa17d01e715df773b1ee7167b91c9cab7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f633268362f7477696c6c2d63726f7070612e737667)[![](https://camo.githubusercontent.com/ded50416a8c6eada3ad74ffb78d4f8e478ebc8afe35b34ebfa507efd6836bcee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f633268362f7477696c6c2d63726f7070612e737667)](https://camo.githubusercontent.com/ded50416a8c6eada3ad74ffb78d4f8e478ebc8afe35b34ebfa507efd6836bcee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f633268362f7477696c6c2d63726f7070612e737667)

This package provides an easy-to-use integration of the Croppa image library into Twill CMS to use as a media and image rendering service. When switching to the provided rendering service, the advantages of Croppa can be used in your Twill application. In addition, a few other utils for working with media in the context of Twill are offered.

### Features

[](#features)

- image rendering service for interfacing with the twill media library
- easy configuration of all plugin settings
- some croppa preconfiguration
- automatic crops deletion on media removal
- traits for media detaching on model deletion

Prequesites/Versioning
----------------------

[](#prequesitesversioning)

Use the following table to find the right version for your Laravel/Twill/Croppa version to fit your environment.

All package releases are available via GitHub and Packagist releases to download.

Package versionCroppa versionTwill versionLaravel version1.x6.x3.x10.x2.x6.x (Patched)\*3.411.x3.x *(Current Version)*6.x (Patched)\*3.5/dev12.xWarning

**V3 depends on a forked version of BKWLD/croppa with applied patches to function with Laravel 12 and the newest version of Twill. Twill depends on older versions of packages used by Croppa, resulting in dependency configurations not installable by composer.**

The Fork and more information is available at . As soon, as these dependency conflicts are resolved, twill-croppa will get an update to use the original version of Croppa once more.

Requirements
------------

[](#requirements)

This package requires the Composer PHP package manager to function and manage its dependencies.

In addition, this package only depends on Twill CMS and Croppa and their dependencies. This is automatically managed via Composer.

Installation
------------

[](#installation)

Installation of this library is easy to do via `Composer`:

```
composer require c2h6/twill-croppa
```

Important

To use this package in your Laravel project with the patched version of Croppa, you need to add the vsc repository for the patched Croppa version to **your root composer-file** by adding:

```
    "repositories": [
       {
           "type": "vcs",
           "url": "https://github.com/C2H6-383/croppa-twill-compatible"
       }
   ],
```

Please run `composer u` to update your packages after that.

If you do not need the patched version of Croppa, please use version 1.x of this package.

Package discovery is automatically done by the Laravel Framework.

You should already set up the storage linking for storing your media files. For further information check [the Twill CMS Docs](https://twillcms.com/docs/getting-started/installation.html).

Usage
-----

[](#usage)

Using the Croppa rendering service is really easy. Just set the rendering service config property in the Twill configuration. Everything else is set up for you.

To set the Image Rendering Service edit the `media_library.image_service` property in the `twill.php` config file. You maybe need to [publish the Twill config files first](https://twillcms.com/docs/getting-started/configuration.html) or add the config properties.

```
...
    'media_library' => [
        'image_service' => \C2H6\TwillCroppa\TwillCroppa::class,
    ],
...
```

For more additional help see

### A note on performance

[](#a-note-on-performance)

When accessing crops for the first time, Croppa needs to render each image. On some servers or environment configurations, this is really slow (2+ seconds per image request). This gets exponentially worse when having many crops or images per page, as these are rendered on-demand.

To hide this from normal visitors when accessing the page, it is recommended to view the preview or access the page before publishing and waiting for all images to load in. An alternative is to render the crops programmatically (see [the Croppa documentation section about the render command](https://github.com/BKWLD/croppa?tab=readme-ov-file#cropparendercropurl)) beforehand or via a queue job.

To use the LQIP images, use the command `php artisan twill:lqip` to generate and store them in the database.

Configuration Options
---------------------

[](#configuration-options)

If you want to change configuration options of this plugin, you can either create a new configuration file called `twillcroppa.php` in the Laravel config directory or publish the default configuration file with the command `php artisan vendor:publish --tag=twillcroppa-config`. A list with a detailed description of the configuration options is displayed below.

This library automatically configures some croppa parameters. To further refine the Croppa settings, please refer to the configuration options of Croppa stated in [the Croppa documentation](https://github.com/BKWLD/croppa).

config optionDefaultdescriptionlqip\_dimension30Default image width/height of the LQIP image if dimensions are not provided.lqip\_quality25JPEG quality (0-100) for the LQIP images, higher means better image quality but larger filesmedia\_files\_path`storage/uploads/`uploads storage path (URL) for discovering and deleting cropsExtra: Media Detaching on Model deletion
----------------------------------------

[](#extra-media-detaching-on-model-deletion)

When dealing with media models while working with Twill there is often the burden to detach any media when deleting a model. Otherwise, there are some dangling references remaining and any of these media files can never be deleted from the application, as twill registers some usage cases.

To speed this process up, this package contains a few PHP traits to automatically detach any media relations on deleting or force deleting a given model:

`C2H6\TwillCroppa\Traits\DetachMediaOnForceDelete::class` for automatically deleting relations on model force deletion and

`C2H6\TwillCroppa\Traits\DetachMediaOnDelete::class` for automatically deleting relations on model (soft) deletion.

For normal use cases, only the first one should be needed, as Twill always uses soft deletes per default. On model deletion, the model is put in a Trash section, where a recovery is possible. Only on removal from this Trash section, a media detachment should be done.

### Usage

[](#usage-1)

To use these traits just add them to any of your models and they should work out of the box.

Package Development
-------------------

[](#package-development)

- clone or fork this GitHub repository and download it to your dev environment
- install all composer dependencies with `composer install`
- run tests with the command `composer test`
- just submit issues and pull requests

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance74

Regular maintenance activity

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~193 days

Total

4

Last Release

147d ago

Major Versions

v1.0.1 → v2.0.02024-12-30

v2.0.0 → v3.0.02025-10-25

PHP version history (3 changes)v1.0.0PHP ^8.2|^8.3

v2.0.0PHP ^8.1|^8.2|^8.3

v3.0.0PHP ^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/e2c3084723daf67ee3e01575fa23b684e16a0fa65300e991895f9a14a5b7a423?d=identicon)[c2h6](/maintainers/c2h6)

---

Top Contributors

[![C2H6-383](https://avatars.githubusercontent.com/u/49997018?v=4)](https://github.com/C2H6-383 "C2H6-383 (24 commits)")

---

Tags

croppalaravel-frameworktwilllaravelimagemediatwillcroppatwillcms

### Embed Badge

![Health badge](/badges/c2h6-twill-croppa/health.svg)

```
[![Health](https://phpackages.com/badges/c2h6-twill-croppa/health.svg)](https://phpackages.com/packages/c2h6-twill-croppa)
```

###  Alternatives

[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

508489.5k18](/packages/bkwld-croppa)[intervention/image-laravel

Laravel Integration of Intervention Image

1445.8M73](/packages/intervention-image-laravel)[spescina/imgproxy

An image proxy for Laravel

201.3k](/packages/spescina-imgproxy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
