๐งฉ Architecture & Core Logic
- Super Powers
- Joomla Powers
- Compile Native Components, Plugins & Modules
- Multi-Version Support
- Conditional Logic Injection
- Reusable Admin Views
- Dynamic GET Builder
- Round-Trip Code Integration
- Custom Admin Views
- Site Views
- Dynamic Dashboards
- Model Linking Between Views
- Shared Field Reuse Across Views
- Drag & Drop Field Mapping
- Dynamic Field Visibility
- Independent Packaging
๐ Joomla CMS Integration
๐งฑ Custom Code System (Powerful Dual Feature)
๐ Field Type System
๐ Snippets, Templates, Layouts, Libraries
- Snippets Reusable Html Blocks
- Layouts Reusable Php Render Templates
- Templates Page Level Views Linked To Custom Admin Site Views
- Libraries JS CSS Assets Linked To UI
- CDN Local Toggle For Library Delivery
- Media Folder Injection With Override Support
- Repository Push Pull Reset Workflow
- Init Snippets Layouts Templates Via Gui
๐ฆ Packages
๐งฉ Architecture & Core Logic
๐ File & Code Management
๐ง Code Reuse & Blueprints
๐ Joomla CMS Integration
๐จ Visual GUI & UX
๐ Internationalization
๐ฆ Packaging & Distribution
โ๏ธ Compiler Engine Features
๐งฑ Custom Code System
๐ Field Type System
๐ Dynamic GET (Visual SQL Engine)
๐ Snippets, Templates, Layouts, Libraries
๐ Documentation & Metadata
๐ Analytics & Insights
๐งฉ Architecture & Core Logic
- Super Powers
- Joomla Powers
- Compile Native Components, Plugins & Modules
- Multi-Version Support
- Conditional Logic Injection
- Reusable Admin Views
- Dynamic GET Builder
- Round-Trip Code Integration
- Custom Admin Views
- Site Views
- Dynamic Dashboards
- Model Linking Between Views
- Shared Field Reuse Across Views
- Drag & Drop Field Mapping
- Dynamic Field Visibility
- Independent Packaging
๐ Joomla CMS Integration
- Token Integration
- ACL Per View, Field, Item
- Field-Based Joomla Config Generation
- Support For Joomla Categories/Tags/Custom Fields
- CLI-Ready Components
- Joomla Update Server Integration
- Version-Aware Language String Compilation
- Remote Publishing to Custom Repo Update Streams
๐ Field Type System
- Field Types Define Templates And Data Types
- Gui Defined Rules Required Unique Nullable
- Save Get Hooks Per Field
- Database Schema Auto Generated From Field Settings
- Per Display Field Rendering Config List Edit
- Create Dynamic Models With Modals Selectors
- Conditional Js And Css Per Field
๐ Snippets, Templates, Layouts, Libraries
- Snippets Reusable Html Blocks
- Layouts Reusable Php Render Templates
- Templates Page Level Views Linked To Custom Admin Site Views
- Libraries JS CSS Assets Linked To UI
- CDN Local Toggle For Library Delivery
- Media Folder Injection With Override Support
- Repository Push Pull Reset Workflow
- Init Snippets Layouts Templates Via Gui
Dynamic Use-Statement Generation
Automatically manage PHP namespace imports with clean, conflict-free use statements.
What Is Dynamic Use-Statement Generation?
In Joomla Component Builder (JCB), Dynamic Use-Statement Generation is the automatic creation of PHP use
statements
based on the classes, traits, interfaces, or helper functions referenced in your componentโs code.
This feature ensures that all required PHP classes are properly imported into your files without duplication, typos, or namespace issues โ even across Joomla versions.
Itโs designed to eliminate manual namespace management, streamline dependency injection, and prevent runtime errors caused by missing class references.
When you use dynamic class references like Joomla Powers (JPKs), custom helper classes, or Super Power entities,
JCB automatically includes the correct use
statement โ scoped to the correct file.
Key Features
- ๐ง Automatic Class Import Detection: JCB scans your layouts, models, controllers, templates, and custom code blocks to detect class references that require importing.
- ๐ Smart Namespace Resolution: Whether your class is part of Joomla core (e.g.,
Joomla\CMS\Factory
) or a namespaced Super Power you created, JCB resolves the correct namespace and maps it to a properuse
statement. - ๐ชช Alias Handling: If a conflict is detected or an alias is defined in JCB (e.g.,
JFactory
asLegacyFactory
), JCB respects that and generatesuse
statements withas
. - ๐ Version-Aware Imports: When using Joomla Powers (JPKs), JCB inserts the correct
use
statement depending on your Joomla version (J3, J4, J5) โ keeping your compiled code version-safe and clean. - ๐ Scoped Insertion:
use
statements are inserted at the top of each PHP file (controllers, models, helpers, views), only if needed โ and only once per class. - ๐งพ No Duplicates or Dead Code: Redundant imports are skipped, and unused
use
statements are removed, keeping the output clean and efficient. - ๐งฌ Works with Custom Code: Even if you reference a class manually in a custom code block or Insert Tag, JCB will still scan and insert the appropriate
use
statement.
Use Cases
- โ
Use
Joomla\CMS\Router\Route
inside a custom controller block โ JCB addsuse Joomla\CMS\Router\Route;
- ๐ง Reference a Super Power class in your helper โ JCB adds the correct namespace to your
helper.php
- ๐ Use Joomla Powers like
@jimport:JFactory
in your logic โ resolved to the correct class with version-awareuse
statements - ๐งฑ Your layout uses
\Joomla\CMS\Language\Text
โ JCB includesuse
statement at the top of the layout file automatically
How to Use
- No action is needed from you in most cases โ JCB handles this automatically.
- If you want to manually trigger or confirm behavior:
- Include a class reference in your logic โ either as a raw namespaced class (e.g.,
new Joomla\CMS\User\UserFactory
), - via a placeholder like
@jimport:JUser
, - or from a Super Power entity used in a helper, controller, or model.
- Include a class reference in your logic โ either as a raw namespaced class (e.g.,
- Compile your component.
- Open the relevant compiled PHP file and check the
use
block at the top โ your reference should now appear. - (Optional) Review debug logs to see what
use
statements were injected and from where.
๐ง Pro Tip: For custom logic blocks, wrap class usage in Insert Tags to preserve it across compiles โ the use
statement will still be auto-managed.
Conclusion
Dynamic Use-Statement Generation brings modern PHP development best practices directly into your JCB workflow. You write logic โ JCB handles the imports. This means cleaner code, fewer runtime errors, better compatibility across Joomla versions, and no more hunting for missing namespaces.