PHPackages                             pinimize/laravel-bz2-compresssion - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pinimize/laravel-bz2-compresssion

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pinimize/laravel-bz2-compresssion
=================================

A Laravel package for compression with Bzip2.

v0.1.0(1y ago)035[3 PRs](https://github.com/pinimize/laravel-bz2-compresssion/pulls)MITPHPPHP ^8.2CI passing

Since Sep 1Pushed 1y agoCompare

[ Source](https://github.com/pinimize/laravel-bz2-compresssion)[ Packagist](https://packagist.org/packages/pinimize/laravel-bz2-compresssion)[ Docs](https://github.com/pinimize/laravel-bz2-compresssion)[ RSS](/packages/pinimize-laravel-bz2-compresssion/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (6)Used By (0)

Pinimize Bzip2 Extension
========================

[](#pinimize-bzip2-extension)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ff76f2c6b9bacfdef4cc0fd6acd23515f25dbd19b450d05d9fadfa2b73e2623a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70696e696d697a652f6c61726176656c2d627a322d636f6d707265737373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pinimize/laravel-bz2-compresssion)[![Tests](https://github.com/pinimize/laravel-bz2-compresssion/actions/workflows/phpunit.yml/badge.svg?branch=main)](https://github.com/pinimize/laravel-bz2-compresssion/actions/workflows/phpunit.yml)[![License](https://camo.githubusercontent.com/fb52e5d0c638d25b50167a28d3484d2f0a04a19f6e15bea8b64654f4219c0c21/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70696e696d697a652f6c61726176656c2d627a322d636f6d707265737373696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pinimize/laravel-bz2-compresssion)

This package provides Bzip2 compression support for the Pinimize compression and archive package for Laravel.

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

[](#requirements)

- PHP 8.2 or higher
- Laravel 11 or higher
- The `ext-bz2` PHP extension must be installed and enabled

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

[](#installation)

First, ensure that the Bzip2 PHP extension is installed. You can check this by running:

```
php -m | grep bz2
```

If you don't see 'bz2' in the output, you'll need to install the extension before proceeding.

Once the Bzip2 extension is installed, you can install the package via composer:

```
composer require pinimize/laravel-bz2-compresssion
```

Prerequisites
-------------

[](#prerequisites)

This package is an extension of the [Pinimize Compression and Archive](https://github.com/pinimize/laravel-compression-and-archive) package. The main Pinimize package will be automatically installed as a dependency for this package.

Configuration
-------------

[](#configuration)

After installation, you need to add the Bzip2 driver configuration to your `config/pinimize.php` file. If you haven't published th main config file, you can do so by running this command:

```
php artisan vendor:publish --provider="Pinimize\PinimizeServiceProvider" --tag="config"
```

Add the following to the `drivers` array:

```
'bz2' => [
    'disk' => env('COMPRESSION_DISK', null),
],
```

Your complete compression configuration should look something like this:

```
'compression' => [
    'default' => env('COMPRESSION_DRIVER', 'gzip'),
    'mixin' => env('COMPRESSION_REGISTER_MIXIN', true),
    'drivers' => [
        ... // Other drivers
        'bz2' => [
            'disk' => env('COMPRESSION_DISK', null),
        ],
    ],
],
```

Usage
-----

[](#usage)

Once configured, you can use the Bzip2 driver just like any other compression driver in Pinimize. All methods available in the main Pinimize package are fully supported with the Bzip2 driver. For example:

```
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage;
use Pinimize\Facades\Compression;
use Pinimize\Facades\Decompression;

// When you have made bz2 the default driver in your configuration:
$compressedStringZlib = Str::compress($originalString);
$decompressedStringGzip = Str::decompress($compressedStringGzip);

// By specifying the driver:
$compressedStringZlib = Str::compress($originalString, 'bz2');
$decompressedStringGzip = Str::decompress($compressedStringGzip, 'bz2');

// Or with the Storage facade:
Storage::compress('/path/to/original.json', '/path/to/compressed.json.bz2');
Storage::decompress('/path/to/compressed.json.bz2', '/path/to/decompressed.json');

// Compress a string using Bzip2
$compressed = Compression::driver('bz2')->string('Hello, World!');

// Default driver
$compressed = Compression::string('Hello, World!');
Compression::put('path/to/compressed.csv.bz2', '/path/to/original.csv');
```

For more detailed usage instructions and a full list of available methods, please refer to the [Pinimize Compression and Archive documentation](https://github.com/pinimize/laravel-compression-and-archive).

Important Notes
---------------

[](#important-notes)

1. The Bzip2 compression algorithm does not support compression levels. The `level` parameter in the configuration is ignored for the Bzip2 driver.
2. The Bzip2 extension must be installed on your server for this package to work. If you're using a managed hosting service, you may need to contact your hosting provider to have it installed.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Testing
-------

[](#testing)

Run the tests with:

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Einar Hansen](https://github.com/einar-hansen)
- [All Contributors](https://github.com/pinimize/laravel-compression-and-archive/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance40

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

618d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7867c8e6cb949ab73460f6189d49e8423431864c495a389e650e82509e44d954?d=identicon)[einar-hansen](/maintainers/einar-hansen)

---

Top Contributors

[![einar-hansen](https://avatars.githubusercontent.com/u/49709354?v=4)](https://github.com/einar-hansen "einar-hansen (2 commits)")

---

Tags

laravelcompressionpinimizebzip2bz2

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/pinimize-laravel-bz2-compresssion/health.svg)

```
[![Health](https://phpackages.com/badges/pinimize-laravel-bz2-compresssion/health.svg)](https://phpackages.com/packages/pinimize-laravel-bz2-compresssion)
```

###  Alternatives

[raulfraile/distill

Smart compressed files extractor

228190.4k9](/packages/raulfraile-distill)[stephenjude/filament-blog

Filament Blog Builder

20317.8k](/packages/stephenjude-filament-blog)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)[mmanos/laravel-casset

An asset management package for Laravel 4.

112.6k](/packages/mmanos-laravel-casset)

PHPackages © 2026

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