PHPackages                             clancats/packtacular - 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. [Caching](/categories/caching)
4. /
5. clancats/packtacular

ActiveLibrary[Caching](/categories/caching)

clancats/packtacular
====================

Packtacular is a simple and fast asset packer and compressor.

2.0.0(12y ago)518MITPHP

Since Mar 21Pushed 12y ago1 watchersCompare

[ Source](https://github.com/mario-deluna/packtacular)[ Packagist](https://packagist.org/packages/clancats/packtacular)[ Docs](https://github.com/mario-deluna/packtacular)[ RSS](/packages/clancats-packtacular/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)DependenciesVersions (2)Used By (0)

Packtacular
===========

[](#packtacular)

Packtacular is a fast and easy asset packer, compressor, manager.

We are all busy so we should not waste time dealing with asset packing. Im also going to skip all the "where the idea came from bla bla" so lets directly continue with how to use Packtacular.

**don't forget that you need to grant write permission's for php.**

Usage
-----

[](#usage)

First of all packtacular need's to know where your storage directory ( public directory ) is. If you don't set up the storage directory packtacular is going to use the relative path.

```
Packtacular::storage( $_SERVER['DOCUMENT_ROOT'].'/' );
```

The thing here was "Hey let's keep it easy" so to create your package you only need to do this:

```
Packtacular::( '', '' );

```

*Example:*

```
// When you pass relative paths packtacular is going to prefix your path
// with the storage directory. `/assets/css/`
Packtacular::css( 'assets/css/', 'cache/stylesheet_:time.css' )
```

This example will return an absolute public path to the package assuming that the target is the public root path. `/cache/stylesheet_1395407386.css`

### A bit more detail

[](#a-bit-more-detail)

```
Packtacular::( |,  );

```

**Type:**This means the basically the file extension. `Packtacular::js` will match all `.js` files in the given directory.

**Source:**I hope this is not to confusing. If you set a folder as source Packtacular is going to search in that directory for all files matching the given type. Alternatively you can pass an array of files.

**Target:**Define where the cache file should be created. You can simply pass a file path. To bypass the problem that the browser might cache the files on its own, you can add a timestamp to the path using the :time parameter.

### Example with a fixed array

[](#example-with-a-fixed-array)

```
Packtacular::js( array(
	'js/jquery.js',
	'js/myscript.js',
), 'cache/:time/core.js' );
```

Filters
-------

[](#filters)

Filters can catch the file contents before they get packed. Wich gives you the possibility to compress or compile your assets.

```
Packtacular::filter( '', function( $data )
{
	// do something with $data
	return $data;
});
```

**There are 2 types of filters package and single file filter.**

*The single filter will be applied over every file on it's own.*

```
// This little example will add a comment above each file
// containing the file path of the current file.
Packtacular::filter( '*', function( $data, $file_name )
{
	return "/* ".$file_name." */\n".$buffer;
}, true );
```

*The normal filter can only modify the entire package.*

```
// This little example will only be executed on the entire package.
Packtacular::filter( 'css', function( $data )
{
	return str_replace( ' ', '', $data );
});
```

Preset filters
--------------

[](#preset-filters)

There are some filter that already ship with packtacular you can add them by simply executing:

```
Packtacular_Filter::add( 'comments' );
```

Following filters are available:

- `comments`

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4436d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b22b6cd3db7191046069cd7dd954e97585d9de1901403f8394c7eb7ae77056e?d=identicon)[clancats](/maintainers/clancats)

---

Top Contributors

[![mario-deluna](https://avatars.githubusercontent.com/u/956212?v=4)](https://github.com/mario-deluna "mario-deluna (14 commits)")

---

Tags

cacheassetpackerpacktacular

### Embed Badge

![Health badge](/badges/clancats-packtacular/health.svg)

```
[![Health](https://phpackages.com/badges/clancats-packtacular/health.svg)](https://phpackages.com/packages/clancats-packtacular)
```

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[psr/cache

Common interface for caching libraries

5.2k686.9M1.3k](/packages/psr-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[beste/in-memory-cache

A PSR-6 In-Memory cache that can be used as a fallback implementation and/or in tests.

2512.2M6](/packages/beste-in-memory-cache)[anahkiasen/flatten

A package for the Illuminate framework that flattens pages to plain HTML

33313.0k](/packages/anahkiasen-flatten)[rtcamp/nginx-helper

Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also provides cloudflare edge cache purging with Cache-Tags.

23817.0k1](/packages/rtcamp-nginx-helper)

PHPackages © 2026

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