Coder Social home page Coder Social logo

Comments (2)

jszobody avatar jszobody commented on July 21, 2024

It's definitely possible. Might take a bit to get it all wired up properly.

Laravel's illuminate/support dependency is required, as I use a number of things like Collections and Str helpers. If you install this package tho, illuminate/support will get installed automatically, as will the base maennchen/zipstream-php package. I don't think you should need to install anything else manually.

To get it working, you'll want to read through the Service Provider and understand how the components are created, and do it manually. It will probably look something like this (untested):

$archiveOptions = new ZipStream\Option\Archive();
$archiveOptions->setZeroHeader(true);

$fileOptions = new ZipStream\Option\File();
$fileOptions->setMethod(ZipStream\Option\Method::STORE);

$zip = new STS\ZipStream($archiveOptions, $fileOptions);

The main ZipStream class does make use of the Laravel config() global helper:

&& config('zipstream.archive.predict');

You may need to create your own quick-n-dirty global config() function that replicates what this package is expecting. Something like (untested):

function config($key) {
    $config = [
        'zipstream.archive.predict' => true
    ];

    return $config[$key];
}

Obviously that could be improved on, it's just the most basic example of what this package would be expecting.

I think from there it might just work if you're zipping up local files from disk. If you are pulling from S3 though, you'll run into issues with the S3File class which is expecting more config() values. So make sure to extend your own config function with the needed S3 config parameters for your app.

(On that note though, I have a PR that changes how this works, the next version of this library won't use config from inside the S3File class.)

Feel free to try it out. I probably won't be able to provide a whole lot of non-Laravel support, but happy to take a look at any error you might hit if you need.

from laravel-zipstream.

mmenavas avatar mmenavas commented on July 21, 2024

Thank you so much for your time and for the quick response! I'll give it a shot and let you know how it goes.

from laravel-zipstream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.