PHPackages                             antiphp/resource-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. antiphp/resource-loader

AbandonedArchivedLibrary[Templating &amp; Views](/categories/templating)

antiphp/resource-loader
=======================

Zend Framework (2) View Helper to load UI resources

010PHP

Since Mar 4Pushed 11y ago1 watchersCompare

[ Source](https://github.com/antiphp/resource-loader)[ Packagist](https://packagist.org/packages/antiphp/resource-loader)[ RSS](/packages/antiphp-resource-loader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Resource Loader
===============

[](#resource-loader)

This one is a Zend Framework (2) View Helper to load CSS and JavaScript resources with a special focus on dependencies.

What's done
-----------

[](#whats-done)

- The resource loader registers the requested CSS and JavaScript resources to your ZF head\*() view helpers and resolves the resource dependencies correctly

    F.e. if you're using Bootstrap, then jQuery is a required resource of Bootstrap. So you have to define two resources, but you only have to load - and think about - the Bootstrap resource, because you already configured the dependency (Bootstrap requires jQuery) in your configurastion.

What's NOT done
---------------

[](#whats-not-done)

- The package does define any dependency, you need to define all the resource dependencies yourself.
- The package does not download (server-side) any of your defined or requested libraries

Configuration
-------------

[](#configuration)

Here's a module configuration example. First of all we need to register the View Helper in the view helper service configuration.

```
return array(
    'view_helpers' => array(
        'factories' => array(
            'resource' => 'AntiPhp\ResourceLoader\View\Helper\ResourceLoaderServiceFactory'
        )
    )
);
```

In the same configruation file we need to define our resource configuration like this:

```
return aray(
    'resource_loader' => array(
        'resources' => array(
            'jquery' => array(
                'js' => 'vendor/jquery/jquery.min.js'
            ),
            'bootstrap' => array(
                'js' => 'vendor/bootstrap/js/bootstrap.min.js',
                'css' => 'vendor/bootstrap/css/bootstrap.min.css',
                'requires' => 'jquery'
            ),
            'bootstrap.themed' => array(
                'css' => 'vendor/bootstrap/css/bootstrap-theme.min.css',
                'requires' => 'boostrap'
            ),
            'yaml' => array(
                'css' => array(
                    'vendor/yaml/css/flexible-columns.css',
                    array('vendor/yaml/yaml/core/iehacks.css', 'lte IE 7')
                ),
                'requires' => 'html5shiv'
            ),
            'my_layout_1' => array(
                'requires' => array(
                    'bootstrap.themed',
                    'font-awesome'
                )
            ),
            'my_layout_2' => array(
                'requires' => 'yaml'
            ),
            // html5shiv, font-awesome, data-tables, ...
        )
    )
);
```

Usage
-----

[](#usage)

Now that the resource loader knows all UI resources, we can use them within our layout based on Bootstrap:

```
$this->resource('my_layout_1');
// refers to configuration key resource_loader/resources/my_layout_1
?>

```

Or maybe we prefer YAML over Bootstrap:

```
$this->resource('my_layout_2');
// refers to configuration key resource_loader/resources/my_layout_2
?>

```

Or within a view script we'd like to use jQuery DataTables:

```
$this->resource('data-table');
?>

```

The resource loader assures that only the required resources are loaded and that you only have to think once about dependencies.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/97efcd0e17319d5af4659982b23f80aa229f284cc08c3f2e40efde99bbab86d2?d=identicon)[antiphp](/maintainers/antiphp)

### Embed Badge

![Health badge](/badges/antiphp-resource-loader/health.svg)

```
[![Health](https://phpackages.com/badges/antiphp-resource-loader/health.svg)](https://phpackages.com/packages/antiphp-resource-loader)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
