PHPackages                             beshkenadze/packager - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. beshkenadze/packager

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

beshkenadze/packager
====================

Packager is a PHP 5.2+ library to concatenate libraries split in multiple files in a single file. It automatically calculates dependancies. Packager requires a yml header syntax in every file, and a package.yml manifest file, as seen on the MooTools project.

0246PHP

Since Sep 14Pushed 13y ago1 watchersCompare

[ Source](https://github.com/beshkenadze/packager)[ Packagist](https://packagist.org/packages/beshkenadze/packager)[ RSS](/packages/beshkenadze-packager/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Packager
========

[](#packager)

Packager is a PHP 5.2+ library to concatenate libraries split in multiple files in a single file. It automatically calculates dependancies. Packager requires a yml header syntax in every file, and a `package.yml` manifest file, as seen on the MooTools project.

Packager API
============

[](#packager-api)

Constructor
-----------

[](#constructor)

The constructor of this class accepts either a path to a package or a list of path to packages. `package.yml` must not be included in the path.

### Example

[](#example)

```
$pkg = new Packager("/Users/kamicane/Sites/mootools-core/");
$pkg = new Packager(array("/Users/kamicane/Sites/mootools-core/", "/Users/kamicane/Sites/mootools-more/"));

```

Adding a manifest
-----------------

[](#adding-a-manifest)

- `parse_manifest` » adds a manifest to this instance

Working with files
------------------

[](#working-with-files)

### Getters

[](#getters)

- `get_all_files` » gets an list of all files
- `get_file_dependancies` » gets an ordered list of every file that this file depends on
- `get_file_path` » gets the file path
- `get_file_source` » gets the file source
- `get_file_description` » gets the file description
- `get_file_provides` » gets a list of the file provided components

### Converters

[](#converters)

- `complete_file` » converts a single file to an ordered list of files
- `complete_files` » converts a list of files to an ordered list of files

### Generators

[](#generators)

- `build_from_files` » returns a string containing the source of the selected files and their dependancies
- `write_from_files` » writes a file with the selected files and their dependancies

Working with components
-----------------------

[](#working-with-components)

### Converting to files

[](#converting-to-files)

- `component_to_file` » gets the name of the file that provides this component
- `components_to_files` » converts a list of components to a list of files

### Generators

[](#generators-1)

- `build_from_components` » returns a string containing the source of the selected components and their dependancies
- `write_from_components` » writes a file with the selected components and their dependancies

Class usage
-----------

[](#class-usage)

### Syntax

[](#syntax)

```
$pkg = new Packager(`$path_to_manifest`);

```

### Example

[](#example-1)

```
$pkg = new Packager("/Users/kamicane/Sites/mootools-core/");

$pkg->write_from_components("/Users/kamicane/Sites/mootools.js", array('Type', 'Array'));

```

Packager Command Line script
----------------------------

[](#packager-command-line-script)

The Packager command line script is your one-stop solution to build any of your packages at once. Works on unices.

### Syntax

[](#syntax-1)

```
./packager COMMAND +option1 argument1 argument2 +option2 argument1 argument2

```

- `COMMAND` a packager command *(required)*
- `+option` options for commands *(optional)*

### Commands

[](#commands)

- `register` registers a package. Creates a .packages.yml file in your home folder.
- `unregister` unregisters a package
- `list` list registered packages
- `build` builds a single file with the supplied packages / files / components

### Registering a Package

[](#registering-a-package)

#### Example

[](#example-2)

```
./packager register /Users/kamicane/mootools-core
» the package Core has been registered

```

### Listing Packages

[](#listing-packages)

#### Example

[](#example-3)

```
./packager list
» Core: /Users/kamicane/mootools-core

```

### Unregistering a Package

[](#unregistering-a-package)

#### Example

[](#example-4)

```
./packager unregister Core
» the package Core has been unregistered

```

### Building Packages

[](#building-packages)

#### Examples

[](#examples)

```
./packager build Core/Type Core/Fx ART/ART.Element

```

Which is the same as...

```
./packager build +components Core/Type Core/Fx ART/ART.Element

```

Which builds the passed in components (and their dependancies) using your registered packages.

```
./packager build +files Core/Core Core/Fx ART/ART

```

This builds the passed in files (and their dependancies) using your registered packages.

```
./packager build ART/*

```

Builds every component from ART, and their dependancies, using your registered packages.

```
./packager build SomePackage/SomeComponent +packages /Users/kamicane/Sites/some-package

```

Builds the selected components using your registered packages and a temporary package that resides in /Users/kamicane/Sites/some-package, without having to register it first.

```
./packager build SomePackage/SomeComponent -packages Core

```

Builds the selected components using your registered packages minus the package names you pass to -packages. This lets you build your components without dependancies.

```
./packager build ART/SomeComponent +use-only ART

```

Builds the selected components using only ART of your registered packages. This lets you build your components without dependancies.

```
./packager build SomePackage/SomeComponent +use-only +packages /Users/kamicane/Sites/some-package

```

Builds the selected components using none of your registered packages plus the passed in package, without registering it. This lets you build your components without dependancies.

```
./packager build +components ART/ART +files ART/ART.Base

```

You can mix components and files

```
./packager build Core/* > mootools.js

```

This is how you output to a file

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.2% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3ed29bffd2536c0c36a534d2b0cc539ace65db12a3dcdef8c31210903010348?d=identicon)[akira](/maintainers/akira)

---

Top Contributors

[![kamicane](https://avatars.githubusercontent.com/u/7131?v=4)](https://github.com/kamicane "kamicane (60 commits)")[![timwienk](https://avatars.githubusercontent.com/u/150598?v=4)](https://github.com/timwienk "timwienk (12 commits)")[![subtleGradient](https://avatars.githubusercontent.com/u/4117?v=4)](https://github.com/subtleGradient "subtleGradient (7 commits)")[![beshkenadze](https://avatars.githubusercontent.com/u/167288?v=4)](https://github.com/beshkenadze "beshkenadze (7 commits)")[![appden](https://avatars.githubusercontent.com/u/70904?v=4)](https://github.com/appden "appden (4 commits)")[![cpojer](https://avatars.githubusercontent.com/u/13352?v=4)](https://github.com/cpojer "cpojer (4 commits)")[![thisconnect](https://avatars.githubusercontent.com/u/546900?v=4)](https://github.com/thisconnect "thisconnect (3 commits)")[![slik](https://avatars.githubusercontent.com/u/98554?v=4)](https://github.com/slik "slik (1 commits)")

### Embed Badge

![Health badge](/badges/beshkenadze-packager/health.svg)

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

###  Alternatives

[keyword-extractor/keyword-extractor

A package to extract keywords from text

118.7k](/packages/keyword-extractor-keyword-extractor)[christianbarkowsky/tabcontrol

Create tabs as content element. Extension for Contao Open Source CMS

109.9k](/packages/christianbarkowsky-tabcontrol)

PHPackages © 2026

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