Using ddev for development of TYPO3 extensions
/ updated on
- TYPO3 v9
- TYPO3 v10
- TYPO3 v11
- TYPO3 v12
As an author and maintainer of several TYPO3 extensions that also support multiple TYPO3 versions, I once faced the problem of how to develop and test them in a simple way. Each extension has its own Git repository and when testing for different TYPO3 versions, cloning or copying the source code multiple times to different TYPO3 installations was not the way I was happy with.
At the time, I had a local Apache installation on my Linux notebook. With symlinks this worked more or less: Different TYPO3 version need different PHP versions. And most importantly, I don't want to have multiple PHP versions installed locally along with Apache. Then ddev came into my life, which made the workflow a lot of easier. If you don't know it yet, have a look at the ddev documentation.
So, let's get started.
My extensions and TYPO3 installations are organised in a
Projects folder as follows:
Projects/ ├── codehighlight ├── form_country_select ├── matomo_integration ├── matomo_widgets ├── schema ├── typo3v10 ├── typo3v11 └── typo3v12
The Git repositories for the extensions are stored there along with TYPO3 installations for different versions that are ddev projects.
Now we have to take two steps to integrate these extensions into the TYPO3 installations:
- Symlink the extension folder into the TYPO3 project installation
- Mount the extension into the ddev web container
First, the extension folder, for example
schema, is symlinked into the TYPO3 project. Here, local extensions are available in a project's
Projects ├── typo3v11 │ ├── packages │ │ └─ schema -> /home/chris/Projects/schema
Under Linux, you link a folder with the command
ln -s /home/chris/Projects/schema schema
In the Windows prompt, for example, this is done (possibly as administrator):
mklink /d schema C:\Users\Chris\Projects\schema
In this way, access to this extension is possible within an IDE in the TYPO3 installation itself, for example for debugging purposes.
Next, we need to mount the extension directory in the ddev web container to make it available there. For this purpose, a file
docker-compose.volumes.yaml is created:
Then we add the local packages path to the composer.json of the project so that the extension can be found there by Composer:
ddev composer config repositories.local path "packages/*"
The last step is to add the extension to the
composer.json file of the project:
ddev composer req "brotkrueml/schema:*@dev"
This workflow helps me a lot when developing TYPO3 extension for multiple TYPO3 versions. I have the choice to code in the extension project and also in a TYPO3 project directly — and of course to debug there.