PHPackages                             gdbots/app-bundle - 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. gdbots/app-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

gdbots/app-bundle
=================

App bundle for Symfony apps.

v4.0.0(4mo ago)316.5k↓50%21Apache-2.0PHPPHP &gt;=8.5

Since Feb 24Pushed 4mo ago4 watchersCompare

[ Source](https://github.com/gdbots/app-bundle-php)[ Packagist](https://packagist.org/packages/gdbots/app-bundle)[ Docs](https://github.com/gdbots/app-bundle)[ RSS](/packages/gdbots-app-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (28)Used By (1)

app-bundle-php
==============

[](#app-bundle-php)

App bundle for symfony apps which provides a base app kernel, device view and viewer country awareness.

AppKernel
---------

[](#appkernel)

Provides an AppKernel interface and an `AbstractAppKernel` which must be extended in your own app. This class provides some basic methods for describing the environment the kernel is running in (cloud provider, region, etc.) and the app details like vendor, package, version, build, etc.

Console Commands
----------------

[](#console-commands)

When an app is deployed we need to execute a symfony command and/or curl the app to verify the deployment was successful. The console command `console app:describe` can return the app details.

Example output from the command:

```
{
  "symfony_version": "5.0.0",
  "app_vendor": "acme",
  "app_name": "blog",
  "app_version": "v0.1.0",
  "app_build": "1487902285",
  "app_deployment_id": "d-IHMA71LSM",
  "app_dev_branch": "master",
  "system_mac_address": "02:a0:57:b4:59:e9",
  "cloud_provider": "private",
  "cloud_region": "us-west-2",
  "cloud_zone": "us-west-2a",
  "cloud_instance_id": "080027a450f9",
  "cloud_instance_type": "vbox",
  "kernel_environment": "local",
  "kernel_debug": true,
  "kernel_bundles": {
    "FrameworkBundle": "Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle",
    "MonologBundle": "Symfony\\Bundle\\MonologBundle\\MonologBundle",
    "SecurityBundle": "Symfony\\Bundle\\SecurityBundle\\SecurityBundle",
    "TwigBundle": "Symfony\\Bundle\\TwigBundle\\TwigBundle",
    "SensioFrameworkExtraBundle": "Sensio\\Bundle\\FrameworkExtraBundle\\SensioFrameworkExtraBundle",
    "AwsBundle": "Aws\\Symfony\\AwsBundle",
    "GdbotsAppBundle": "Gdbots\\Bundle\\AppBundle\\GdbotsAppBundle",
    "AppBundle": "AppBundle\\AppBundle",
    "DebugBundle": "Symfony\\Bundle\\DebugBundle\\DebugBundle"
  }
}
```

Example use in CodeDeploy ValidateService hook:

```
if (( $( curl -s --resolve ${app_domain}:8080:127.0.0.1 http://${app_domain}:8080/health-check | grep -c "APP_DEPLOYMENT_ID = '${DEPLOYMENT_ID}'" ) > 0 ))
then
  echo "[${APP_NAME}] validate success (curl)"
else
  echo "[${APP_NAME}] validate failure (curl), does not have [APP_DEPLOYMENT_ID = '${DEPLOYMENT_ID}']"
  exit 1
fi

app_deployment_id=`sudo -H -u ${APP_OWNER} php ${APP_DIR}/bin/console app:describe --env=${APP_ENV} --no-debug --no-interaction | jq -r '.app_deployment_id'`
if [ "${app_deployment_id}" == "${DEPLOYMENT_ID}" ]; then
  echo "[${APP_NAME}] validate success (console)"
else
  echo "[${APP_NAME}] validate failure (console), app returned '${app_deployment_id}', expected '${DEPLOYMENT_ID}'"
  exit 1
fi
```

Device View Awareness
---------------------

[](#device-view-awareness)

If device detection is in use and was evaluated for the current request a string identifying the "view" that is to be delivered to the user will be pushed into an environment variable by the server.

This string is completely up to the app developer as what view is given to the user is not necessarily going to match exactly to the form factor of the device.

For example, a smarttv might be shown the "desktop" view of the app.

Examples: desktop, smartphone, smarttv, etc.

This bundle doesn't provide any detection, it merely injects the "decision" into the request attributes and provides some methods to make template resolution simple. The actual detection is done by a tool better suited for that, like CloudFront. For example, in an Apache rewrite rule:

```
  RewriteCond %{HTTP:CloudFront-Is-Mobile-Viewer} =true
  RewriteCond %{HTTP:CloudFront-Is-Tablet-Viewer} =false
  RewriteRule ^ - [E=DEVICE_VIEW:smartphone]

```

The "device\_view" would now equal "smartphone" and be available as a twig variable, a request attribute or an environment variable. Example use in a controller:

```
declare(strict_types=1);

namespace AppBundle\Controller;

use Gdbots\Bundle\AppBundle\Controller\DeviceViewRendererTrait;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

final class DefaultController extends Controller
{
    use DeviceViewRendererTrait;

    /**
     * @Route("/")
     *
     * @return Response
     */
    public function indexAction(): Response
    {
        // if device_view is populated and the template index.smartphone.html.twig exists, it will be used
        // otherwise the "index.html.twig" file will be loaded.
        return $this->renderUsingDeviceView('@app/index%device_view%.html.twig');
    }
}
```

Using [Twig dynamic inheritance](http://twig.sensiolabs.org/doc/2.x/tags/extends.html#dynamic-inheritance) you can make use of the `device_view` variable to provide a device specific layout when available.

```
{% extends ['layout.' ~ device_view ~ '.twig.html', 'layout.twig.html'] %}

I'm on a {{ device_view }}.
```

Viewer Country Awareness
------------------------

[](#viewer-country-awareness)

Using the same strategy as device view, this value contains the viewer's country. This string should be a two digit ISO country code, all uppercase or null.

This bundle doesn't provide any detection, it merely injects the "decision" into the request attributes and provides some methods to make template resolution simple. The actual detection is done by a tool better suited for that, like CloudFront. For example, in an Apache rewrite rule:

```
  RewriteCond %{HTTP:CloudFront-Viewer-Country} ([A-Z0-9]{2})
  RewriteRule ^ - [E=VIEWER_COUNTRY:%1]

```

You can reference the value in Symfony request with `$request->attributes->get('viewer_country')` or in twig with `I'm in {{ viewer_country }}.`

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance78

Regular maintenance activity

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor1

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

###  Release Activity

Cadence

Every ~124 days

Recently: every ~181 days

Total

27

Last Release

122d ago

Major Versions

v0.5.2 → v1.0.02019-06-09

v1.0.3 → v2.0.02020-05-28

v2.5.2 → v3.0.02025-02-13

v3.0.1 → v4.0.02026-01-16

PHP version history (8 changes)v0.1.0PHP &gt;=7.1

v0.5.0PHP &gt;=7.2

v2.0.0PHP &gt;=7.4

v2.2.0PHP &gt;=8.0

v2.3.0PHP &gt;=8.1

v2.5.0PHP &gt;=8.2

v3.0.0PHP &gt;=8.4

v4.0.0PHP &gt;=8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/04ecf55609310eefdd08182fdc75aec01f6c5aa9657ec6729ac54e6f5dd5f0ef?d=identicon)[gdbrown](/maintainers/gdbrown)

---

Top Contributors

[![gdbrown](https://avatars.githubusercontent.com/u/3344831?v=4)](https://github.com/gdbrown "gdbrown (56 commits)")[![arunkarnati](https://avatars.githubusercontent.com/u/3432250?v=4)](https://github.com/arunkarnati "arunkarnati (1 commits)")

---

Tags

symfony-bundle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gdbots-app-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/gdbots-app-bundle/health.svg)](https://phpackages.com/packages/gdbots-app-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/storefront

Storefront for Shopware

684.2M148](/packages/shopware-storefront)

PHPackages © 2026

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