Download the PHP package kachkaev/assets-version-bundle without Composer

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

KachkaevAssetsVersionBundle

Latest Stable Version Total Downloads License Build Status Coverage Status

⚠️ The repo is no longer maintained
See its forks, e.g. grizzlylab/KachkaevAssetsVersionBundle

Updating the assets version manually at each deploy is a real pain. This Symfony2 & Symfony3 bundle automates the process and thus makes your life a bit happier.

The bundle can read and write assets_version parameter in app/config/parameters.yml (or any other *.yml file) from the Symfony console. The original file formatting is carefully preserved, so you won’t lose your comments or empty lines between the groups of parameters, if there are any.

Imagine the configuration of your project looks the following way:
 
app/config/config.yml

app/config/parameters.yml

You simply call bin/console assets-version:increment, v042 changes to v043 and all your assets get a new URL: my_cosy_homepage.css?v042my_cosy_homepage.css?v043. More features are described below.

It is important to clear prod cache after updating the assets version for a change to take effect (just as with any other application parameter).

Versioning your project’s assets is a common good practice. More on the assets_version parameter can be found in the Symfony docs:
http://symfony.com/doc/2.6/reference/configuration/framework.html#assets-version

Installation

Run

Register the bundle in app/AppKernel.php

New to installing 3rd party bundles? Symfony docs will help:
http://symfony.com/doc/current/cookbook/bundles/installation.html

Configuration

Here is the default configuration for the bundle:

You don’t need to add anything to for these values to apply.

Option 1 (simple): Assets versioning is done on the server

If you are not using AsseticBundle for compressing your css and js files or if you call on the production server, you normally don’t want the changes of to show up in your git repository. All you have to do then is the following:

  1. Modify your local copies of and :

  2. Enable in (see the top of this file)

  3. Commit and push local changes (this will also include a new line in and edits in both and )

  4. Go to the server, and . Since you have a new entry in , you will be asked to confirm that you want to copy to . You do. Press enter.

  5. All done! Now each time you want to update the version of the assets, call these commands on the server:

Note: Replace with if you haven’t switched to Symfony3 yet.

Option 2 (recommended): Assets versioning is under the source control

If your app is running on multiple production servers or if you have a lot of css and js to compress with , you will benefit from keeping compiled assets and their version in the project’s git repo. It takes a bit more time to prepare for the deploy, but the rest happens nearly instantly. You won’t need UglifyCSS, UglifyJS or other assetic filters on your hosting and will be able to switch to any stable project version in a moment. A cheap server may struggle when compiling assets as this sometimes takes a lot of processor time, so you are saving yourself from that potential problem too.

Since is listed in , should be stored somewhere else.

  1. Create and link to it from
     
    app/config/assets_version.yml

    app/config/config.yml

    Do not add to !

  2. Enable in (see the top of this file)

  3. Add the following lines to :

  4. That’s it, you are ready to commit what you have! Now each time you want to update the assets on the server, follow this routine:
     
    on the local machine

    on the production server(s)

    Make sure that the compiled assets are not in !

Tip: Type less and do more by keeping common command sequences in shell scripts. Examples:
 
bin/refresh_prod (to be used on the local machine)

bin/update_from_repo (to be used on the server)

Console commands

The bundle adds two commands to the symfony console: assets-version:increment and assets-version:set.
Usage examples:

The value for assets version must consist only of letters, numbers and the following characters: .-_. Incrementing only works when the current parameter value is integer or has a numeric ending.

Please don’t forget to clear cache by calling bin/console cache:clear --env=prod for changes to take effect in the production environment.

Capifony integration

If you are using Capifony you can automate increment of assets_version during deployment using such code placed in deploy.rb:


All versions of assets-version-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.2
symfony/framework-bundle Version ~2.3|~3.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 kachkaev/assets-version-bundle contains the following files

Loading the files please wait ....