Download the PHP package bagisto/bagisto-varnish without Composer

On this page you can find all versions of the php package bagisto/bagisto-varnish. 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 bagisto-varnish

Varnish Integration for Bagisto

This package integrates Varnish Cache with Bagisto to boost site performance by delivering cached pages quickly, while still supporting dynamic components through ESI (Edge Side Includes) or AJAX-based dynamic views.


πŸ“Œ Features


πŸ”„ Request Flow

image

Explanation:

Flow Summary: Browser β†’ Nginx β†’ Varnish Proxy β†’ Bagisto β†’ Response (cached or fresh)


πŸ“¦ Installation

1. Install via Composer

2. Register the Service Provider

In bootstrap/providers.php:

Note: Autoloading via Composer’s package auto-discovery is not possible for this provider. The registry order mattersβ€”VarnishServiceProvider must be listed after the Shop package or at the end of the providers array. Auto-discovery would load it too early, which can cause issues.

3. Publish Assets & Config


βš™οΈ Varnish Server Configuration

  1. Install Varnish 6.x on your server.

  2. Replace /etc/varnish/default.vcl with the provided file:

  3. Restart Varnish:

🎨 Theme Integration

You can integrate dynamic content in two ways:


1 – Define Dynamic Views / Fragments

In config/varnish.php, define a key (identifier) and its corresponding Blade view path:


2 – ESI Include


3 – AJAX Dynamic View (Recommended for LCP)


πŸ—‚ Cache-Control Headers

For routes that should NOT be cached by Varnish:

For routes that should be cached:

(Example: 7 days)


Middleware for Cache Headers in Bagisto

We’ve created a middleware Webkul\Varnish\Http\Middleware\VarnishCache to handle cache headers.

Attach it to routes like this:


πŸ›  UI Configuration (Export VCL)

Navigate to: Admin β†’ Configuration β†’ Full Page Cache β†’ Configuration

Select Varnish as the cache application, then provide the following:

  1. Access List – IPs allowed to purge the cache (e.g., localhost).
  2. Varnish Host URL – Varnish server IP and port for purging/banning cache via UI.
  3. Backend Host URL – Laravel Bagisto server IP used in the exported VCL.
  4. Backend Host Port – Laravel Bagisto server port used in the exported VCL.
  5. Grace Period – Duration for serving stale content if the backend is slow or unavailable.

πŸ›  Cache Management

Navigate to: Admin β†’ Configuration β†’ Full Page Cache β†’ Cache Management

  1. Purge by URLs – Enter full URLs (comma-separated) to clear specific cache entries. Paths and domains must match exactly.
  2. Purge Everything – Clears all cache entries from Varnish. Use with caution, as it may temporarily affect performance.

πŸ›‘ Automatic Cache Purging

The package automatically purges cache when:

You can also manually trigger purging by adding your own events in EventServiceProvider and calling:


πŸ–₯ Admin Panel Tools


πŸš€ Best Practices


All versions of bagisto-varnish with dependencies

PHP Build Version
Package Version
No informations.
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 bagisto/bagisto-varnish contains the following files

Loading the files please wait ....