Download the PHP package articus/zf2-bower-module without Composer

On this page you can find all versions of the php package articus/zf2-bower-module. 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 zf2-bower-module

Bower integration module for Zend Framework 2

This module provides a convenient way to manage JavaScript dependencies loaded with Bower within your Zend Framework 2 application.

If your Zend Framework 2 application has a complex front-end with lots of external JavaScript dependencies Bower package manager might be your salvation. But there is one major inconvenience when you use ZF2 and Bower together: for debugging you usually want your JS-dependencies to be in separate non-obfuscated files while for deploying you want them in single obfuscated file. You can create two partial views and switch them via template map but that feels a bit awkward. This module solves this issue in (hopefully :)) more elegant way.

Get Bower packages

First of all you need to find and get all Bower packages that your application requires using either Bowerphp or any other way you prefer. Then you need to set bower.bower_folder.os setting in your configuration - it should point to bower_components folder where you have just installed all packages. By default it is supposed to be located inside ZF2 application root.

Declare packs of Bower packages

Next you need to declare packs of Bower packages you want to use. Each pack is a collection of Bower packages which you want to have in both combined (for deploying) and separated (for debugging) states. To do that you need to set:

Most configuration options have default values (check config/module.config.php for details), so the only thing you have to declare in your ZF2 app config is something like this (sample is in YAML just to make it easier to read):

bower:
  debug_mode: false
  packs:
    main:
      token: 'f22f0d9703c2ef8dc9cc14f6286ee302'
      modules:
        - jquery-form
        - jquery-mousewheel
        - jquery.jscrollpane
        - angular
        - angular-animate
        - angular-messages
        - angular-ui-router
    admin:
      type: 'application/javascript'
      modules:
        - jquery
        - angular
        - bootstrap
    polyfill:
      attributes:
        conditional: '[if IE 9]'
      modules:
        - html5shiv

Beware of hidden dependencies between packages: module does its best to detect package dependencies from bower.json files but some of them are not declared there (like between jquery.mousewheel and jquery.scrollpane).

Prepare pack content

Next you need to generate content for pack folder and debug folder. That can be done with console command bower prepare-packs provided by this module (so you need to execute something like php ./public/index.php bower prepare-packs which obviously depends on structure of your ZF2 app) or you can do that manually if you prefer more sophisticated instrument like grunt or gulp. In later case you just need to prepare file <pack name>.min.js for each declared pack in pack folder and file <bower package name>.js for each Bower package you used to declare packs in debug folder.

Use pack in template

Last but not the least you need to use 'bower' view helper provided by this module to add all required JS files to either inlineScript or headScript container in your template. For example if you declared pack 'main' you can write something $this->bower('main'); to append all JS required for main pack to inlineScript view helper. Or if you want normal IDE autocomplete:

/** @var BowerModule\View\Helper\Bower $bower */
$bower = $this->plugin('bower');
$bower('main');

Enjoy!

Hopefully this module will be helpful for someone except me :) Fill free to report issues and/or suggest new features.


All versions of zf2-bower-module with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
zendframework/zend-stdlib Version >=2.3
zendframework/zend-mvc Version >=2.3
zendframework/zend-servicemanager Version >=2.3
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 articus/zf2-bower-module contains the following files

Loading the files please wait ....