MySQL Some years ago it was only possible to do local development using a local installed PHP version, a local installed database and a local installed web server on your development machine. The disadvantage of this solution is, if you have to work with diﬀerent projects that need diﬀerent PHP versions, you have to install more than one PHP version and have to handle that the diﬀerent projects use the correct PHP version when you switch between the projects. You also have to set up the network conﬁguration for the hostname resolution if you don’t want to use localhost or the IP address. And you have to conﬁgure the web server to serve the content from the right directory. This could result in a lot of needless work.
think this must be done more easier and they made packages which are containing a web server, a database and some PHP versions. The installation is easier, only one program to install. The conﬁguration is also a lot easier. You can conﬁgure all needed settings in one user interface.
• MAMP • AMPOS2 • XAMPP These packages are already known as LAMP, WAMP, MAMP, AMPOS2 or XAMPP. In this abbreviations the A stands for the Apache web server, the M stands for the MySQL database server, the P stands for PHP and the other letters are standing for the operating system, L for Linux, W for Windows, M for MacOS and OS2 for OS/2 and eComStaion. The X in XAMPP stands for cross-platform and the second P stands for Perl. The most used package today is XAMPP I think, and that is brought to us by the Apache Friends.
time to set up a local environment a lot in comparison to the native installation of the single components. But these solutions also have drawbacks. XAMPP for example has PHP conﬁgured as an Apache module what makes it impossible to use diﬀerent PHP versions at the same time.
Next in time virtual machines came up. Solutions like VMWare or VirtualBox could be used to set up a virtual machine per project. With all project speciﬁc settings separated from other projects. The disadvantage is that you have to set up a complete server image with an operating system and a development environment including the web server, database server and PHP by yourself.
Vagrant Box called TYPO3.Homestead which is maintained by Michiel Roos. I have used this box for some time to review patches for the TYPO3 core very easily. My scripts for doing this were adopted from Michiel and are included in the TYPO3.Homestead box. It is no longer maintained because creating it with current TYPO3 versions results in a very large virtual machine, so it has to be redesigned.
is called docker. There are a lot of ready to use containers for web servers, database servers and programming languages like PHP, Perl and so on. The complexity is to ﬁnd the right containers and orchestrate them in the right way to work smoothly together using Docker Compose. Compose is a tool for deﬁning and running multi-container Docker applications. You have to conﬁgure how the diﬀerent container are interacting together and with the outside with writing more or less complex docker conﬁguration ﬁles.
set up a local PHP development environment in shortest time • Use Docker without getting in touch with the conﬁguration DDEV is an Open Source Tool to set up a local PHP development environment in shortest time. It uses Docker without getting in touch with the conﬁguration of the docker container.
Requirement: Docker Compose • Information about the Installation of DDEV and the requirements: https://ddev.readthedocs.io/en/latest/ All you need before installing DDEV is an installed version of docker and docker-compose. Detailed information about the installation and the requirements of DDEV you can ﬁnd in their documentation.
composer create-project typo3/cms-base-distribution t3dd18demo ^9 I show you setting up a fresh TYPO3 installation. Requirement for this kind of installation, beside DDEV, is an installed composer version on the local machine. composer create-project typo3/cms-base-distribution t3dd18demo ^9 cd t3dd18demo ddev conﬁg ddev start ddev stop nano .ddev/conﬁg.yaml # set php version to 7.2 ddev start touch public/FIRST_INSTALL ddev describe
clone https://github.com/TYPO3/ TYPO3.CMS.BaseDistribution.git -b 9.x t3dd18gitdemo • cd t3dd18gitdemo • mkdir -p public/typo3conf • ddev conﬁg • nano .ddev/conﬁg.yaml set PHP to 7.2 and remove # from hooks (3 lines) • ddev start • touch public/FIRST_INSTALL git clone https://github.com/TYPO3/TYPO3.CMS.BaseDistribution.git -b 9.x t3dd18gitdemo cd t3dd18gitdemo mkdir -p public/typo3conf ddev conﬁg !! docroot = public !! type=typo3 In .ddev/conﬁg.yaml the PHP version must be set to 7.2 and a hook must be activated. hooks: post-start: - exec: “composer install -d /var/www/html“ ddev start touch public/FIRST_INSTALL For Core Development: https://docs.typo3.org/typo3cms/ContributionWorkﬂowGuide/Appendix/SpeciﬁcTopics/DdevSettingUpTypo3.html#ddev
in the current directory (/Users/michael/Source/ddev/v9test) Once completed, your configuration will be written to /Users/michael/Source/ddev/v9test/.ddev/config.yaml Project name (v9test): The docroot is the directory from which your site is served. This is a relative path from your application root (/Users/michael/Source/ddev/v9test) You may leave this value blank if your site files are in the application root Docroot Location: web Found a typo3 codebase at /Users/michael/Source/ddev/v9test/web. Application Type [backdrop, php, drupal7, drupal8, wordpress, drupal6, typo3] (typo3): Configuration complete. You may now run 'ddev start'. ddev conﬁg
... done Starting ddev-v9test-dba ... Starting ddev-v9test-web ... done Network ddev_default is external, skipping Creating ddev-router ... done Successfully started v9test Your project can be reached at http://v9test.ddev.local and https://v9test.ddev.local ddev start
typo3 ~/Source/ddev/v9test http://v9test.ddev.local running https://v9test.ddev.local Project Information ----------------- PHP version: 7.2 MySQL Credentials ----------------- Username: db Password: db Database name: db Host: db Port: 3306 To connect to mysql from your host machine, use port 32800 on 127.0.0.1. For example: mysql --host=127.0.0.1 --port=32800 --user=db --password=db --database=db Other Services -------------- MailHog: http://v9test.ddev.local:8025 phpMyAdmin: http://v9test.ddev.local:8036 DDEV ROUTER STATUS: healthy ddev describe
is really easy to import the data of your project. For the database you can import the SQL ﬁle of your projects database to the DDEV database. This can be done after starting the container with the import-db parameter of the DDEV command. Plain text and compressed ﬁles can be used as source for the import. There is also an import-ﬁles command but that doesn’t work for TYPO3 at the moment. For the ﬁles you can add a copy of your ﬁleadmin folder to the project directory.
ddev remove • ddev remove —remove-data • ddev exec • ddev logs ddev list Shows all DDEV projects and paths ddev remove Removes a docker container, helpful if ddev start shows error messages about DB container ddev remove —remove-data Removes the docker container and the database ddev exec ls -la Runs a command inside the docker container ddev logs Shows the logs, for example the error log.
• NodeJS • NPM • Yarn • Xdebug • PhpMyAdmin • MailHog There are many tools installed in the container which you can easily access on a shell connection to the container. ddev ssh Get a shell connection to the web container. Starting directory is the document root.
a directory • Conﬁgure the project with ddev config • Start the project with ddev start • Optional: Import data with ddev import-db Let us summing up what we have learned. You have to install your project ﬁles in a directory. This depends on your project settings. Installing via composer, from a source download or with a git checkout, all is possible. After you have conﬁgured the project you can start the container and work on your project.
DRUD Technology, LLC https://www.drud.com • Interview on the TYPO3 YouTube Channel https://www.youtube.com/watch?v=Xz8tE2Vzngo&t=850s • Documentation https://ddev.readthedocs.io/en/latest/ • Source https://github.com/drud/ddev • DDEV on Slack #ddev You have seen the diﬀerent possibilities to setup your local development environment You can use native components You can use Virtual machines And you can use containers You have seen how easy it is to setup a local development environment for your projects in very short time Take some time, after lunch, tomorrow or next week in your oﬃce and give DDEV a try. I am shure you won’t do development without DDEV afterwards.