Download the PHP package backpack/download-operation without Composer

On this page you can find all versions of the php package backpack/download-operation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package download-operation

DownloadOperation

Latest Version on Packagist Total Downloads The Whole Fruit Manifesto

This package provides a way to add "Download" buttons to your Backpack CRUDs. By default:

Demo

Backpack Download and BulkDownload buttons

Requirements

This package uses Backpack for Laravel (of course) but also spatie/browsershot, which itself uses Puppeteer, which itself uses a headless Chrome browser to generate the PDFs. Because of that:

Installation

Step 0. Install Puppeteer and spatie/browsershot, as instructed by Browsershot documentation. Then test your installation by runnning a tinker session (php artisan tinker) with the following code: \Spatie\Browsershot\Browsershot::url('https://google.com')->ignoreHttpsErrors()->save('example.pdf');. If that simple code triggers errors, please fix your Browsershot / Puppeteer installation before going any further. We've provided a few troubleshooting tips & tricks at the bottom of this page.

Step 1. Install this package via Composer

Step 2. To add a "Download" button next to each entry inside your EntityCrudController and a bulk button at the bottom of the table, use these operations on your EntityCrudController:

Please note that BulkDownloadOperation is not a "real" operation. It's just a button that points to the normal "Download" operation. So you cannot use BulkDownloadOperation without DownloadOperation. The inverse is possible, only using DownloadOperation without BulkDownloadOperation.

Step 3. Configure your download operation by defining your fields and settings in setupDownloadOperation()

Configuration

Publish the config file

You can optionally publish the config file to overwrite the default settings:

Configure the Browsershot instance

If you need to change the way the PDF is generated, you can create a new __invokable() class. The class should return the Browsershow result we will stream to the browser. Here is an example:

Configure the download method

If you need to change the way the file is downloaded, you can create a new downloadFile() method in your EntityCrudController. Here is an example:

Changelog

Changes are documented here on Github. Please see the Releases tab.

Contributing

Please see contributing.md for a todolist and howtos.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

This project was released under MIT, so you can install it on top of any Backpack & Laravel project. Please see the license file for more information.

Troubleshooting

This package uses spatie/browsershot, which uses Puppetteer, which itself uses a headless Chrome. So... a lot can go wrong during the installation phase. It can either go silky-smooth or be a nightmare. To help you out, here are a few issues we've encountered, and their solutions.

How to test if the Puppeteer installation is working

We recommend you run a tinker (php artisan tinker) and try the following:

If that triggers errors... the problem is with your Puppeteer installation. Take a hard look at the error message, it might provide steps to fix or clues.

Could not find Chromium (rev. 1095492)

We've gotten this error, along the years, for multiple reasons:

Cache path is wrong (eg. on MacOS when using Laravel Valet)

In your error message, see what cache path is being used. Most likely it's trying to use .cache/puppeteer inside the PROJECT DIRECTORY. Which is wrong, because it definitely won't find Chrome there. You want it to use the GLOBAL DIRECTORY. To define a cache path for a particular project, you can define a new .ENV variable:

You might also need to create that directory and restart your server. After that, it should work.

Does not work on M1 Mac (aka. chromium arm64 bug)

If you're running an M1 or M2 Mac, you might need to follow this tutorial.

Other problems

We heavily recommend you check Puppeteer's troubleshooting page: https://pptr.dev/troubleshooting


All versions of download-operation with dependencies

PHP Build Version
Package Version
Requires backpack/crud Version ^5.0|^6.0
spatie/browsershot Version ^3.41|^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package backpack/download-operation contains the following files

Loading the files please wait ....