vahadigital/pimcore-project-info-bundle
最新稳定版本:v1.0.0
Composer 安装命令:
composer require vahadigital/pimcore-project-info-bundle
包简介
Pimcore bundle for displaying project information from environment variables
README 文档
README
A Pimcore 11+ bundle that provides project information from environment variables through Twig functions.
Features
- 🏷️ Display project name from
PROJECT_NAMEenvironment 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
Note: The bundle automatically registers itself via Pimcore's auto-discovery. No manual bundle configuration needed!
2. 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
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Support
- 🐛 Issues: GitHub Issues
- 📧 Email: dev@vahadigital.com
- 🌐 Website: Vaha Digital
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.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-18