vahadigital/pimcore-project-info-bundle

Pimcore bundle for displaying project information from environment variables

v1.0.0 2025-08-17 19:50 UTC

This package is not auto-updated.

Last update: 2025-08-18 17:19:15 UTC


README

A Pimcore 11+ bundle that provides project information from environment variables through Twig functions.

Features

  • 🏷️ Display project name from PROJECT_NAME environment variable
  • 🌍 Show environment information (APP_ENV)
  • 🔄 Automatic environment display (adds environment to name if not production)
  • 🎨 Easy Twig integration with custom functions
  • ⚡ Self-configuring services (no manual setup required)

Installation

Install:

composer require vahadigital/pimcore-project-info-bundle

Enable the Bundle

Add the bundle to your config/bundles.php:

<?php

return [
    // ... other bundles
    VahaDigital\ProjectInfoBundle\ProjectInfoBundle::class => ['all' => true],
];

Note: The bundle automatically registers its services via DependencyInjection. No manual service configuration needed!

3. Clear Cache

php bin/console cache:clear

Environment Variables

Set these variables in your .env file:

PROJECT_NAME=My Awesome Project
APP_ENV=dev

Usage in Twig Templates

Basic Functions

{# Get project name #}
{{ project_name() }}

{# Get display name (includes environment if not prod) #}
{{ project_display_name() }}

{# Get all project info as array #}
{% set info = project_info() %}

Complete Example

<!DOCTYPE html>
<html>
<head>
    <title>{{ project_display_name() }}</title>
</head>
<body>
    <h1>{{ project_name() }}</h1>
    
    {% set info = project_info() %}
    <div class="project-info">
        <p>Environment: {{ info.environment }}</p>
        {% if info.is_development %}
            <div class="dev-warning">Development Mode</div>
        {% endif %}
    </div>
</body>
</html>

Available Functions

Function Description Example Output
project_name() Raw project name from env "My Project"
project_display_name() Name with env (if not prod) "My Project (DEV)"
project_info() Complete info array See below

Project Info Array Structure

[
    'name' => 'My Awesome Project',
    'environment' => 'dev',
    'display_name' => 'My Awesome Project (DEV)',
    'is_production' => false,
    'is_development' => true,
]

Development

Bundle Structure

pimcore-project-info-bundle/
├── src/
│   ├── ProjectInfoBundle.php          # Main bundle class
│   ├── Service/
│   │   └── ProjectInfoService.php     # Core logic
│   └── Twig/
│       └── ProjectInfoExtension.php   # Twig functions
├── composer.json                      # Package definition
└── README.md                         # This file

Requirements

  • PHP 8.1+
  • Pimcore 11.0+
  • Twig 3.0+

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support

Changelog

v1.0.0

  • Initial release
  • Project name and environment display
  • Twig functions: project_name(), project_display_name(), project_info()
  • Automatic service configuration

License

MIT License - see LICENSE file for details.