Download the PHP package psb/psb-foundation without Composer

On this page you can find all versions of the php package psb/psb-foundation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package psb-foundation

PSB Foundation

Enhanced extension programming in Extbase


IMPORTANT See CHANGELOG.md for upgrading from v1 to v2!

What does it do?

This extension

IMPORTANT

psb_foundation is designed to simplify common recurrent settings. Although it offers a versatile set of configurations and tools, you may not be able to map certain complex scenarios with it. But you can still make use of this extension. For example, you can use the auto-generation of the TCA and add special settings via files in TCA/Overrides/ as usual.

Why should you use it?

The goal of this extension is to

Getting started

Create the following file: EXT:your_extension/Classes/Data/ExtensionInformation.php. Define the class and make it extend PSB\PsbFoundation\Data\AbstractExtensionInformation.

Example:

You can use inherited functions like getExtensionKey() or getVendorName() to get rid of hard-coded identifiers, if you want to.

psb_foundation (don't forget to add it to your extension's dependencies) searches all active packages for the file EXT:your_extension/Classes/Data/ExtensionInformation.php and checks if that class implements the PSB\PsbFoundation\Data\ExtensionInformationInterface. All extensions that meet these requirements are taken into account during automated configuration processes, e.g. during TCA generation or icon registration.

TCA generation

You don't need to create a special file for your domain model in Configuration/TCA anymore! psb_foundation will scan your Classes/Domain/Model-directory for all classes (skipping abstract ones) that have an attribute of type PSB\PsbFoundation\Attribute\TCA\Ctrl in their PHPDoc-comment. The script checks if your model relates to an existing table in the database and detects if it extends another model from a different extension and manipulates the TCA accordingly.

You can provide configuration options via attributes. The attribute PSB\PsbFoundation\Attribute\TCA\Column provides general configuration fields for all TCA types, e. g. required, displayCond and nullable. Additional attributes with default values for specific types can be found in psb_foundation/Classes/Attribute/TCA/ColumnType/.

Simple example:

Properties without TCA[...]-attribute will not be considered in TCA-generation. Some configurations will be added automatically if specific fields are defined in the CTRL attribute (which they are by default):

Property Default value
enableColumns > disabled hidden
enableColumns > endtime endtime
enableColumns > starttime starttime
languageField sys_language_uid
transOrigDiffSourceField l10n_diffsource
transOrigPointerField l10n_parent
translationSource l10n_source

The fields for enableColumns will be added in additional tabs at the end of showitems for all types.

The relational types inline and select have a special property named linkedModel. Instead of using foreign_table you can specify the class name of the related domain model and psb_foundation will insert the corresponding table name into the TCA.

Additionally, the properties foreign_field and mm_opposite_field accept property names. These will be converted to column names.

Extended example:

Tabs and palettes

The argument position allows you to assign a field to a specific tab or palette.

Example:

Without further configuration, tab and palette will be registered with the given identifier and added to the end of the showitems-list. But you can add additional information for tabs and palettes. For now, the identifiers of palettes and tabs have to be written in snake_case!

It's possible to use the tab:-prefix for a palette's position, too.
If a property references a field inside a palette there are two more special prefixes that can be used:

These will insert an additional --linebreak-- between those fields.

The label of tabs and palettes is determined in the following way:

  1. Use the attribute if given. (can be a LLL-reference)
  2. Use the default language label if existent. (see Default language label paths and additional configuration options)
  3. Use the identifier.

The behaviour for the description of palettes is similar:

  1. Use the attribute if given. (can be a LLL-reference)
  2. Use the default language label if existent. (see Default language label paths and additional configuration options)
  3. Leave empty.

Database definitions

Database definitions are added automatically based on the TCA-attributes used for your properties. You can override the auto-generated definition by defining the field in the ext_tables.sql by yourself or by using the property databaseDefinition of attribute PSB\PsbFoundation\Attribute\TCA\Column.

Priority order:

  1. ext_tables.sql
  2. [Column(databaseDefinition: '...')]

  3. default of ColumnType attribute

Extending domain models

When you are extending domain models (even from extensions that don't make use of psb_foundation) you have to add the @TCA\Ctrl-attribute! You have the possibility to override ctrl-settings. If you don't want to override anything: just leave out the brackets. The default values of the attribute class will have no effect in this case.

Default language label paths

These language labels will be tried if you don't provide a custom value for them. The path always is EXT:your_extension/Resources/Private/Language/Backend/Configuration/TCA/(Overrides/)[modelName].xlf.

Configuration value Default language label
ctrl->title ctrl.title
property->label [propertyName]
property->description [propertyName].description
palette->description palette.[identifier].description
palette->label palette.[identifier].label
tab->label tab.[identifier].label

When you use the items-property for a select field, you may provide a simple associative array. It will be transformed into the required multi-level format. The labels will be build this way:
[propertyName].[arrayKeyTransformedToLowerCamelCase]

Registering and configuring plugins

Actions without the PluginAction-attribute won't be registered - even if mentioned in the optional action list in ExtensionInformation.php!
If no action list is provided, all actions with the PluginAction-attribute will be registered. Which action will be used as default action and which actions should not be cached is determined by the attributes property values only. Check the default values and comments in EXT:psb_foundation/Classes/Attribute/.

FlexForms

If there is a file named EXT:your_extension/Configuration/FlexForms/[PluginName].xml it will be registered automatically. You can override this default by passing a value for the flexForm-property to the PluginConfiguration-constructor. You can either provide a filename if your XML-file is located inside the Configuration/FlexForms/-directory or a full file path beginning with EXT:.

Content element wizard

Plugins will be added to the wizard automatically. There will be a tab for each vendor. You can override the location of your wizard entry by setting the group-property of PluginConfiguration. The following language labels are taken into account automatically if defined:

If the label for title does not exist, this label will be tried: EXT:your_extension/Resources/Private/Language/Backend/Configuration/TCA/Overrides/tt_content.xlf:plugin.[pluginName].title
This label is also used for the select box item (CType)`. If it doesn't exist either, the plugin name will be used as fallback.

[group] defaults to the vendor name (lowercase) if not set within PluginConfiguration. That also defines the tab of the content element wizard. If a new tab is created, its label will be fetched from here: EXT:your_extension/Resources/Private/Language/Backend/Configuration/TsConfig/Page/Mod/Wizards/newContentElement.xlf:[group].header

Custom page types for single plugins

You can add a custom page type that renders a specific plugin only. Simply define a typeNum in your PluginConfiguration:

Classes/Data/ExtensionInformation.php

psb_foundation will create the necessary TypoScript so that this plugin can be called directly with the request parameter type=1589385441. If you defined a typeNum, you can add more specific information for that page type:

Option Type Description Default
typeNumCacheable boolean whether the output should be cached? false
typeNumContentType ContentType (Enum) defines the information about the content sent in header text/html
typeNumDisableAllHeaderCode boolean whether the plugin output should not be wrapped inside the page's template true

Registering and configuring modules

This process is very similar to the way plugins are registered. You only have to add a special registration file for modules, which is required by the core. The content of this file can always be almost identical (see example below) - just adapt the namespace to your ExtensionInformation class. Look into the configuration classes to see all available options and their default values.

The AbstractModuleController class contains some basic template preparations which allow you to render your template in the same way as in plugin controllers: return $this->htmlResponse()!

Modules need to provide three labels:

Label Description
mlang_labels_tabdescr used as module description in the about-module
mlang_labels_tablabel used as short description when hovering over the module link
mlang_tabs_tab used as module title

The following fallbacks account for main modules and submodules, if no custom value is specified:

Fallbacks regarding submodules only:

Check the other configuration options and comments in EXT:psb_foundation/Classes/Attributes/.

Registering custom page types

Classes/Data/ExtensionInformation.php

The keys (doktype) have to be of type integer. name is the only mandatory value. If you don't provide an icon identifier this default identifier will be used: page-type-your-page-type-name. The identifier is also used as base for further icon-variants.

Example ('name' => 'custom'):

You don't have to provide all these icons. The icons for regular pages will be used as fallback. Your SVG-files should to be located in this directory: EXT:your_extension/Resources/Public/Icons/ All icons in that directory will be registered by their name automatically. Unless label is defined, EXT:your_extension/Resources/Private/Language/Backend/Configuration/TCA/Overrides/page.xlf:pageType.yourPageTypeName will be used. If that key doesn't exist, name will be transformed from "yourPageTypeName" to "Your page type name".

Auto-registration of TypoScript-files

If there are .typoscript-files located in EXT:your_extension/Configuration/TypoScript], psb_foundation will execute \PSB\PsbFoundation\Utility\TypoScript\TypoScriptUtility::registerTypoScript() for that directory. You can provide a custom title for the select item in the template module with EXT:your_extension/Resources/Private/Language/Backend/Configuration/TCA/Overrides/sys_template.xlf:template.title - defaults to 'Main configuration'.

Auto-registration of TSconfig-files

If this file exists, it will be included automatically:

The core already handles the inclusion of

Auto-registration of icons

All PNG- and SVG-files located in EXT:your_extension/Resources/Public/Icons will be registered automatically. The extension key and the file name are used as icon identifier.

Examples (filename => icon identifier):

Extension settings

Log missing language labels

If activated, missing language labels will be stored in tx_psbfoundation_missing_language_labels. All missing default labels (e.g. plugin title or field label) will be listed this way if you didn't provide a custom label. Fixed entries get removed on next check (every time the cache is cleared).
It's recommended to check this table during extension development.

Helper classes

ContextUtility

PSB\PsbFoundation\Utility\ContextUtility offers short and easy access to basic information.

GlobalVariableService

PSB\PsbFoundation\Service\GlobalVariableService allows easy and performant access to often needed data. This service is a container where data providers can be registered by their class name. Providers are instantiated only when they are accessed (and then only once). Data that no longer changes can be cached within the GlobalVariableService for the current request.

It's possible to register own providers that implement PSB\PsbFoundation\Service\GlobalVariableProviders\GlobalVariableProviderInterface. You can extend PSB\PsbFoundation\Service\GlobalVariableProviders\AbstractProvider. Three providers are shipped within this extension.

Examples:

StringUtility

PSB\PsbFoundation\Utility\StringUtility contains some string manipulation functions, e.g.:

TranslateViewHelper

PSB\PsbFoundation\ViewHelpers\TranslateViewHelper is an extended clone of the core's TranslateViewHelper.

Additional features:

TypoScriptProviderService

PSB\PsbFoundation\Service\TypoScriptProviderService offers a convenient way to retrieve specific TypoScript-settings. As first argument you can provide the array path you want to access. The following arguments are the same as for the ConfigurationManager known from Extbase.

Examples:

The values returned by this service have been converted to the correct type already (using StringUtility::convertString()). If you set displayOptions.showPreview = 1 the last example will return an integer. If you set displayOptions.showPreview = true it will return a boolean. Not set constants will be returned as null instead of {$...}.

UploadService

This service provides one method that should be called from a controller action which handles a form submit:

This method receives a domain model instance to associate the uploaded files with and an Extbase request object. It does not have a return value, but will throw an exception if something goes wrong. You will have to handle those cases in your code!

The requirement for the processing of uploaded files is that the name of the file input fields of the form match the corresponding properties' name!

By default the files will be stored in fileadmin/user_upload/ by their original name as sent by the client (all special characters being removed). This can be changed via TCA:

See comments in class constructor for more information on certain options.


All versions of psb-foundation with dependencies

PHP Build Version
Package Version
Requires ext-fileinfo Version *
ext-simplexml Version *
php Version ^8.1
typo3/cms-core Version ^12.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package psb/psb-foundation contains the following files

Loading the files please wait ....