PHPackages                             quazardous/silex-pack - 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. [Framework](/categories/framework)
4. /
5. quazardous/silex-pack

ActiveLibrary[Framework](/categories/framework)

quazardous/silex-pack
=====================

A bundle like framework for Silex 2.x

63771PHP

Since Mar 21Pushed 9y ago1 watchersCompare

[ Source](https://github.com/quazardous/silex-pack)[ Packagist](https://packagist.org/packages/quazardous/silex-pack)[ RSS](/packages/quazardous-silex-pack/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

silex-pack
==========

[](#silex-pack)

Add bundle like system to Silex 2.x

There is a [demo project](#demo) !

What ?
------

[](#what-)

Silex Pack add some code structuring in your Silex project. It mimics the [Symfony Bundle](http://symfony.com/doc/current/cookbook/bundles/best_practices.html) feature.

### mountable pack

[](#mountable-pack)

Packs can provides controllers and prefix where to mount.

Implement `Quazardous\Silex\Api\MountablePackInterface`

### twiggable pack

[](#twiggable-pack)

Packs can define private Twig templates folder with override capability from the application templates folder.

Implement `Quazardous\Silex\Api\TwiggablePackInterface`

For a pack class `AcmeDemoPack` Silex pack will register a `@AcmeDemo` namespace with Twig. `@AcmeDemo` is created from `PackInterface::getName()`.

Now you can use something like that in your controllers:

```
...
return $app->renderView('@AcmeDemo/default/hello.html.twig', $vars);
...
```

Within `.twig` templates, you can also use `@AcmeDemo`, ie for `extends` clause:

```
{% extends '@AcmeDemo/base.html.twig' %}
...
```

If you register `twig.path`, Silex Pack will look for overriden templates in these folders.

```
...
$app->register(new TwigServiceProvider(), ['twig.path' => '/path/to/app/views']);
...
```

For `@AcmeDemo/default/hello.html.twig` we will look for in `/path/to/app/views/AcmeDemo/default/hello.html.twig`. Cute no ?

### entitable pack

[](#entitable-pack)

Packs can expose entites to Doctrine ORM.

Implement `Quazardous\Silex\Api\EntitablePackInterface`

### consolable pack

[](#consolable-pack)

Packs can add commands to the console.

Implement `Quazardous\Silex\Api\ConsolablePackInterface`

### configurable pack

[](#configurable-pack)

Packs can have config files. All the config files will be injected into the application container.

Implement `Quazardous\Silex\Api\ConfigurablePackInterface`

### assetable pack

[](#assetable-pack)

Packs can have assets.

Implement `Quazardous\Silex\Api\AssetablePackInterface`

```
...
{% stylesheets '@AcmeDemo/css/*.css' output="css/acme_demo.css" %}

{% endstylesheets %}
...
```

You have to register the provided Assetic service provider because we have to inject a "namespace aware" assetic factory.

The provided `assetic.factory` knows how to handle paths with `@AcmeDemo` prefix.

`@AcmeDemo` is derived from `PackInterface::getName()`.

See `Quazardous\Silex\Provider\AsseticServiceProvider`

The assets dump is done in the standard `$app['assetic.path_to_web']`.

See [Silex Assetic](https://github.com/mheap/Silex-Assetic) from more info on this provider.

### translatable pack

[](#translatable-pack)

Packs can have translations.

Implement `Quazardous\Silex\Api\TranslatablePackInterface`

You can provide yaml files, xliff files or php files (returning a key =&gt; translation array).

### linkable pack

[](#linkable-pack)

You can create symlinks between project and pack (ie. for public files).

Implement `Quazardous\Silex\Api\LinkablePackInterface`

You'll have to execute the provided command `pack:symlinks`.

### optionnable pack

[](#optionnable-pack)

You can inject common options into your pack.

Implement `Quazardous\Silex\Api\OptionnablePackInterface`

```
...
$app->register(new AcmeDemoPack(), [
    'acme_demo.mount_prefix' => '/acme/demo',
    'acme_demo.entity_subnamespace' => 'Model',
]);
...
```

See below.

Usage
-----

[](#usage)

### Install

[](#install)

```
composer require quazardous/silex-pack

```

Use `Quazardous\Silex\PackableApplication` instead of `Silex\Application`.

Implements the interfaces you need and register your pack as a classic service provider.

```
...
$app = new Quazardous\Silex\PackableApplication;
...
use Acme\DemoPack\AcmeDemoPack;
$app->register(new AcmeDemoPack());
...
```

Enjoy (or not) !

### Jet pack

[](#jet-pack)

Silex Pack provides a basic dropin trait implementation for the trivial functions:

Use `Quazardous\Silex\Pack\JetPackTrait`

And a all in one interface:

Implement `Quazardous\Silex\Pack\JetPackInterface`

So with `JetPackInterface` + `JetPackTrait` you should just have to provide some options:

```
...
$app->register(new AcmeDemoPack(), [
    'acme_demo.mount_prefix' => '/acme/demo',
    'entity_subnamespace' => 'Model',
]);
...
```

The user pack namespace `acme_demo.` is derived from `PackInterface::getName()` wich result is decamelize.

See `JetPackTrait::$packOptions` for a list of all options.

NB: you will need to manualy add all the suggested dependencies (see the demo project for a typical composer.json).

### Commands

[](#commands)

Silex pack uses [Sillex Console](https://github.com/quazardous/silex-console).

Silex pack provides assetic commands:

- `assetic:dump` : dumps the assets
- `assetic:watch` : watches the assets and dumps if modifications

Register `Quazardous\Silex\Provider\AsseticCommandsProvider`

Silex pack provides pack commands:

- `pack:symlinks` : create pack symlinks

Register `Quazardous\Silex\Provider\PackCommandsProvider`

Pack folders
------------

[](#pack-folders)

A pack has no strict structure but it could/should be very similar to bundle:

```
+-- Acme/ :
|   +-- AlphaPack/
|   |   +-- AcmeAlphaPack.php
|   |   +-- Command/
|   |   +-- Controller/
|   |   +-- Entity/
|   |   +-- assets/
|   |   +-- configs/
|   |   +-- fixtures/
|   |   +-- locales/
|   |   +-- public/
|   |   +-- views/
|   |
|   +-- BetaPack/
|

```

Demo
----

[](#demo)

See a [full working demo](https://github.com/quazardous/silex-pack-demo).

You can use it as a quick bootstrap for your project.

Features Silex User Pack (see below).

Some pack projects
------------------

[](#some-pack-projects)

- [Silex User Pack](http://github.com/quazardous/silex-user-pack): user security helper pack

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.3% 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/f9b424f56493e5f1fa6ae1edf6552cefbb24755fd9949618e57c9373edcd8ce6?d=identicon)[quazardous](/maintainers/quazardous)

---

Top Contributors

[![quazardous](https://avatars.githubusercontent.com/u/1506211?v=4)](https://github.com/quazardous "quazardous (57 commits)")[![valqk](https://avatars.githubusercontent.com/u/1799031?v=4)](https://github.com/valqk "valqk (1 commits)")

### Embed Badge

![Health badge](/badges/quazardous-silex-pack/health.svg)

```
[![Health](https://phpackages.com/badges/quazardous-silex-pack/health.svg)](https://phpackages.com/packages/quazardous-silex-pack)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M836](/packages/laravel-socialite)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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