Download the PHP package becklyn/assets-bundle without Composer

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

BecklynAssetsBundle

High-performance asset handling for symfony projects.

This bundle is a simplified and specialized replacement for symfony/asset.

Installation

and then add the bundle in your AppKernel / bundles.php.

Load the routes (preferably only in dev):

To use the static compression of assets, install zopfli or gzip.

Info / Purpose

This bundle aims to provide a way to transparently handle long-term caching of assets.

All assets in your entry points are copied (and possibly transformed) to public/assets/ and the file names modified, so that they contain the content hash of the given file. It also provides Twig functions to use these translated paths transparently in a symfony application.

In Twig the original filename is given to the asset* function and it automatically generates the HTML reference for the hashed file name.

Warning: the directory public/assets/ is completely cleared on cache clear, so it should exclusively be managed by this bundle.

All requests to the assets/ directory can be cached for a long time, like with a expiry date in the far future or even immutable headers.

Usage

The asset generation and preparation is done automatically. The assets are pregenerated on cache clear + warmup or on-the-fly generated if encountered with an empty cache.

In the configuration a mapping of namespaces to directories is defined. These namespaces are then used to retrieve paths to these files by using the @{namespace}/{path} syntax:

In Twig, the following functions can be used:

Asset Processing

Currently only one asset processor is included in the bundle. Asset processors are chosen by file extension and are supposed to transform the given file content. They are not supposed to alter the file in terms of minification, but to adjust import paths (like url(...) in CSS) to the new paths.

Currently registered processors:

Processor File Extensions Purpose
CssProcessor .css Rewrite url(...) paths.

Warning: The asset processors are using the paths from the AssetCache. This implies a race condition, as the processor can only rewrite paths of files that were already added to the cache. So files with a processor are deferred and only processed after all other files are finished (at least if the command / cache warmer is used). There still can be race conditions, if files with processors depend on each other.

Configuration

All configuration values with their description and defaults:

Commands

becklyn:assets:reset

The bundle provides a command to clear and warmup the cache:

Normally these commands are not required, as the bundle automatically registers as cache clearer and cache warmer.

becklyn:assets:namespaces

This command prints an overview over all registered namespaces. This is especially useful if you register paths programmatically outside of your configuration.

nginx Integration

Your project can cache the dumped assets indefinitely, as the file names are derived from the content.


All versions of assets-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
becklyn/html-builder Version ^2.2.1
psr/cache Version ^1.0.1 || ^2.0.0 || ^3.0.0
symfony/cache-contracts Version ^2.5.0 || ^3.0.0
symfony/config Version ^5.4.3 || ^6.0.3
symfony/console Version ^5.4.3 || ^6.0.3
symfony/dependency-injection Version ^5.4.3 || ^6.0.3
symfony/filesystem Version ^5.4.3 || ^6.0.3
symfony/finder Version ^5.4.3 || ^6.0.3
symfony/http-kernel Version ^5.4.4 || ^6.0.4
symfony/mime Version ^5.4.3 || ^6.0.3
symfony/process Version ^5.4.3 || ^6.0.3
symfony/routing Version ^5.4.3 || ^6.0.3
symfony/service-contracts Version ^2.5.0 || ^3.0.0
twig/twig Version ^3.3.8
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 becklyn/assets-bundle contains the following files

Loading the files please wait ....