承接 pinimize/laravel-lzf-compresssion 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pinimize/laravel-lzf-compresssion

最新稳定版本:v0.1.0

Composer 安装命令:

composer require pinimize/laravel-lzf-compresssion

包简介

A Laravel package for compression with lzf.

README 文档

README

Latest Version on Packagist Tests License

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

Requirements

  • PHP 8.2 or higher
  • Laravel 11 or higher
  • The ext-lzf PHP extension must be installed and enabled

Installation

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

php -m | grep lzf

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

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

composer require pinimize/laravel-lzf-compresssion

Prerequisites

This package is an extension of the Pinimize Compression and Archive package. The main Pinimize package will be automatically installed as a dependency for this package.

Configuration

After installation, you need to add the LZF 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:

'lzf' => [
    '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
        'lzf' => [
            'disk' => env('COMPRESSION_DISK', null),
        ],
    ],
],

Usage

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

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

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

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

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

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

// Default driver
$compressed = Compression::string('Hello, World!');
Compression::put('path/to/compressed.csv.lzf', '/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.

Important Notes

  1. The LZF compression algorithm does not support compression levels. The level parameter in the configuration is ignored for the LZF driver.
  2. The LZF 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

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

Testing

Run the tests with:

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固