Download the PHP package oro/requirejs-bundle without Composer

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

OroRequireJSBundle

OroRequireJSBundle uses the RequireJS library to enable a modular structure of JS components in Oro applications.

The bundle enables developers to define RequireJS configuration in YAML files on the bundle level. It also provides a CLI tool to collect RequireJS modules and configuration from bundles, merge and minify them in the production mode.

For details of the RequireJS configuration options, see RequireJS API. For details of the RequireJS build options, see example.build.js.

Require.js config generation

Configuration

Common options for require.js config are placed in :

oro_require_js:
    config: # common options which will eventually get into require.js config file
        waitSeconds: 0
        enforceDefine: true
        scriptType: 'text/javascript'

Bundle specific options are defined inside file, which is placed in . It can have three sections , and (see RequireJS API). Each bundle's javascript module have to be defined in section, where key is a module name and value is its relative path from the document root.

config:
    shim:
        'jquery-ui':
            deps:
                - 'jquery'
    map:
        '*':
            'jquery': 'oroui/js/jquery-extend'
        'oroui/js/jquery-extend':
            'jquery': 'jquery'
    paths:
        'jquery': 'bundles/oroui/lib/jquery-1.10.2.js'
        'jquery-ui': 'bundles/oroui/lib/jquery-ui.min.js'
        'oroui/js/jquery-extend': 'bundles/oroui/js/jquery-extend.js'

Generation

Main require.js config is generated automatically and embedded in HTML-page. The config is stored in application cache. In case you wish to renew require.js configuration, just clean cache.

Usage

To get require.js script with its configuration on your page, just include scripts.html.twig template from OroRequireJSBundle to <head/> tag of your index.html.twig template.

<head>
    <!-- -->
    {% include 'OroRequireJSBundle::scripts.html.twig' %}
    <!-- -->
</head>

The template scripts.html.twig accepts two optional parameters compressed and config_extend.

Runtime require.js main config extension

Sometimes it is not enough to specify require.js configuration settings statically, it is required to modify certain parameters dynamically at each launch. It is possible to do this over config_extend parameter for OroRequireJSBundle::scripts.html.twig template. That variable can contain a piece of custom configuration which will be applied after general configuration is loaded and before any module is utilized.

E.g. to dynamically define the path to translation dictionary (depending on what locale is currently used):

{% set requirejs_config_extend %}
    require({
        paths: {
            'oro/translations':
                '{{ url('oro_translation_jstranslation')[0:-3] }}'
        }
    });
{% endset %}

In terms of sequence of code execution, it looks the following way:

  1. Prod mode (and built resource exists)

    • execute all custom configurations

    • load single minified js-resource (with + and rest of modules)
  2. Dev mode (or built resource does not exist)
    • load
    • load
    • execute all custom configurations

See

Build project

Configuration

Build configuration starts in

oro_require_js:
    build_path: "js/oro.min.js"     # relative path from document root folder to project built
    building_timeout: 3600
    js_engine: "node"               # can be configured to use other engine, e.g. Rhino
    build_logger: false             # show in browser console not optimized RequireJS modules 
    build:                          # build.js's common options
        optimize: "uglify2"
        preserveLicenseComments: true
        generateSourceMaps: true
        useSourceUrl: true

See details for options.

Beside general build-configuration, you can set bundle specific options inside file, root section .

build:
    paths:
        'autobahn': 'empty:'

This directive will prevent module from getting concatenated into build file.

Building

To make a build for JS-resources, just execute a command in console:

php bin/console oro:requirejs:build

It will:

  1. take initial configuration from ();
  2. extend it with configuration found in bundles ();
  3. generate - a config for builder;
  4. run builder (time consuming process, especially for Rhino JS-engine);
  5. remove .

All versions of requirejs-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
symfony/symfony 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 oro/requirejs-bundle contains the following files

Loading the files please wait ....